summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-26 08:42:24 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-26 08:43:53 -0400
commit0522f6adedd2736cbca3c0e16ca51df668993eee (patch)
tree36ff5ee208fa97cf86b717ed0eb2e9ca4251315d /fs
parentc5efa5fc91f1f6d1d47e65f39e7ec6d1157c777d (diff)
downloadlinux-3.10-0522f6adedd2736cbca3c0e16ca51df668993eee.tar.gz
linux-3.10-0522f6adedd2736cbca3c0e16ca51df668993eee.tar.bz2
linux-3.10-0522f6adedd2736cbca3c0e16ca51df668993eee.zip
NFS: Fix another nfs_wb_page() deadlock
J.R. Okajima reports that the call to sync_inode() in nfs_wb_page() can deadlock with other writeback flush calls. It boils down to the fact that we cannot ever call writeback_single_inode() while holding a page lock (even if we do set nr_to_write to zero) since another process may already be waiting in the call to do_writepages(), and so will deny us the I_SYNC lock. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/write.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b8a6d7af2a1..91679e2631e 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1518,14 +1518,17 @@ int nfs_wb_page(struct inode *inode, struct page *page)
};
int ret;
- while(PagePrivate(page)) {
+ for (;;) {
wait_on_page_writeback(page);
if (clear_page_dirty_for_io(page)) {
ret = nfs_writepage_locked(page, &wbc);
if (ret < 0)
goto out_error;
+ continue;
}
- ret = sync_inode(inode, &wbc);
+ if (!PagePrivate(page))
+ break;
+ ret = nfs_commit_inode(inode, FLUSH_SYNC);
if (ret < 0)
goto out_error;
}