[PATCH] xfs: wait for direct I/O to complete in fsync and write_inode

Christoph Hellwig hch at infradead.org
Sat Mar 6 07:20:18 CST 2010


We need to wait for all pending direct I/O requests before taking care of
metadata in fsync and write_inode.

Note that the write_inode hunk will causes conflicts when merging with
mainline, I'm not sure how to best deal with that.

Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: xfs/fs/xfs/linux-2.6/xfs_file.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_file.c	2010-03-06 14:10:12.247004588 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_file.c	2010-03-06 14:16:48.460003752 +0100
@@ -115,6 +115,8 @@ xfs_file_fsync(
 
 	xfs_iflags_clear(ip, XFS_ITRUNCATED);
 
+	xfs_ioend_wait(ip);
+
 	/*
 	 * We always need to make sure that the required inode state is safe on
 	 * disk.  The inode might be clean but we still might need to force the
Index: xfs/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_super.c	2010-03-06 14:10:12.259026379 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_super.c	2010-03-06 14:16:48.461003193 +0100
@@ -1079,6 +1079,8 @@ xfs_fs_write_inode(
 		if (error)
 			goto out;
 
+		xfs_ioend_wait(ip);
+
 		/*
 		 * Make sure the inode has hit stable storage.  By using the
 		 * log and the fsync transactions we reduce the IOs we have




More information about the xfs mailing list