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

Christoph Hellwig hch at infradead.org
Sat Apr 17 19:02:53 CDT 2010


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

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-15 09:24:53.332004798 -0700
+++ xfs/fs/xfs/linux-2.6/xfs_file.c	2010-04-16 09:50:08.197004486 -0700
@@ -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-04-05 11:21:31.643011861 -0700
+++ xfs/fs/xfs/linux-2.6/xfs_super.c	2010-04-16 09:51:19.891255575 -0700
@@ -1092,6 +1092,7 @@ xfs_fs_write_inode(
 		 * the code will only flush the inode if it isn't already
 		 * being flushed.
 		 */
+		xfs_ioend_wait(ip);
 		xfs_ilock(ip, XFS_ILOCK_SHARED);
 		if (ip->i_update_core) {
 			error = xfs_log_inode(ip);




More information about the xfs mailing list