From 1be3d0ecd702f2dafb1c88a6d79115c90ba68b4e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 14 Jan 2009 20:36:44 +0100 Subject: [PATCH] fixes and debug Signed-off-by: Jens Axboe --- fs/buffer.c | 16 +++++++++++++--- fs/nfs/pagelist.c | 2 +- include/linux/pagemap.h | 2 +- include/linux/wait.h | 2 +- net/sunrpc/sched.c | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 02e2d02ac0c8..9bbae13011ce 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1923,8 +1923,10 @@ static int __block_prepare_write(struct inode *inode, struct page *page, int ret; ret = wait_on_buffer_async(*--wait_bh, current->io_wait); - if (ret && !err) + if (ret && !err) { + WARN(1, "%s: ret\n", __FUNCTION__); err = ret; + } if (!buffer_uptodate(*wait_bh)) err = -EIO; } @@ -2596,8 +2598,10 @@ int nobh_write_begin(struct file *file, struct address_space *mapping, int err; err = wait_on_buffer_async(bh, current->io_wait); - if (err && !ret) + if (err && !ret) { + WARN(1, "%s: ret\n", __FUNCTION__); ret = err; + } if (!buffer_uptodate(bh)) ret = -EIO; } @@ -2859,6 +2863,10 @@ int block_truncate_page(struct address_space *mapping, if (!buffer_uptodate(bh) && !buffer_delay(bh) && !buffer_unwritten(bh)) { ll_rw_block(READ, 1, &bh); err = wait_on_buffer_async(bh, current->io_wait); + if (err) { + WARN(1, "err=%d\n", err); + goto out; + } /* Uhhuh. Read error. Complain and punt. */ err = -EIO; if (!buffer_uptodate(bh)) @@ -3361,8 +3369,10 @@ int bh_submit_read(struct buffer_head *bh) get_bh(bh); bh->b_end_io = end_buffer_read_sync; submit_bh(READ, bh); - if (wait_on_buffer_async(bh, current->io_wait)) + if (wait_on_buffer_async(bh, current->io_wait)) { + WARN(1, "%s: err\n", __FUNCTION__); return -EIOCBRETRY; + } if (buffer_uptodate(bh)) return 0; return -EIO; diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index e2975939126a..cbf2e49b5b3e 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -191,7 +191,7 @@ nfs_wait_on_request(struct nfs_page *req) if (!test_bit(PG_BUSY, &req->wb_flags)) goto out; ret = out_of_line_wait_on_bit(&req->wb_flags, PG_BUSY, - nfs_wait_bit_killable, TASK_KILLABLE); + nfs_wait_bit_killable, TASK_KILLABLE, NULL); out: return ret; } diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 4fe31627fc57..3c80f3a45688 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -348,7 +348,7 @@ static inline int lock_page_async(struct page *page, struct wait_bit_queue *wq) */ static inline void lock_page(struct page *page) { - WARN_ON(current->io_wait); + WARN_ON(in_aio(current)); lock_page_async(page, NULL); } diff --git a/include/linux/wait.h b/include/linux/wait.h index 7f1205637f2f..f2699c76cafb 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -416,7 +416,7 @@ static inline int is_sync_wait_bit_queue(struct wait_bit_queue *wq) return 1; } -#define in_aio(tsk) is_sync_wait_bit_queue((tsk)->io_wait) +#define in_aio(tsk) !is_sync_wait_bit_queue((tsk)->io_wait) /* * Must be called with the spinlock in the wait_queue_head_t held. diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index cef74ba0666c..68a232968853 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -669,7 +669,7 @@ static void __rpc_execute(struct rpc_task *task) dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); status = out_of_line_wait_on_bit(&task->tk_runstate, RPC_TASK_QUEUED, rpc_wait_bit_killable, - TASK_KILLABLE); + TASK_KILLABLE, NULL); if (status == -ERESTARTSYS) { /* * When a sync task receives a signal, it exits with -- 2.25.1