Patchwork [2/7] fs: block_page_mkwrite should wait for writeback to finish

login
register
mail settings
Submitter Darrick J. Wong
Date May 10, 2011, 5:12 p.m.
Message ID <20110510171245.GF18929@tux1.beaverton.ibm.com>
Download mbox | patch
Permalink /patch/95008/
State Not Applicable
Headers show

Comments

Darrick J. Wong - May 10, 2011, 5:12 p.m.
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.

Slight rework based on Jan Kara's suggestion.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---

 fs/buffer.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/buffer.c b/fs/buffer.c
index a08bb8e..0e7fa16 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2367,8 +2367,10 @@  block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
 			ret = VM_FAULT_OOM;
 		else /* -ENOSPC, -EIO, etc */
 			ret = VM_FAULT_SIGBUS;
-	} else
+	} else {
+		wait_on_page_writeback(page);
 		ret = VM_FAULT_LOCKED;
+	}
 
 out:
 	return ret;