>From 408d0a667ebdc7edd24d05c8de4b42cc1629e84f Mon Sep 17 00:00:00 2001 From: Darrick J. Wong Date: Thu, 19 May 2011 14:14:11 +0200 Subject: [PATCH] vfs: Wait in __block_page_mkwrite for IO to finish For filesystems such as nilfs2 and xfs that use block_page_mkwrite, modify that function to wait for pending writeback before allowing the page to become writable. This is needed to stabilize pages during writeback for those two filesystems. Signed-off-by: Darrick J. Wong Signed-off-by: Jan Kara --- fs/buffer.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index b0675bf..161685d 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2365,6 +2365,8 @@ int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, if (unlikely(ret < 0)) goto out_unlock; + /* Wait so that we don't change page under IO */ + wait_on_page_writeback(page); /* * Freezing in progress? We check after the page is marked dirty and * with page lock held so if the test here fails, we are sure freezing -- 1.7.1