提交 0522f6ad 编写于 作者: T Trond Myklebust

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: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 c5efa5fc
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册