]> Pileus Git - ~andy/linux/blobdiff - fs/xfs/linux-2.6/xfs_super.c
[XFS] fix error inversion problems with data flushing
[~andy/linux] / fs / xfs / linux-2.6 / xfs_super.c
index cc5e07e3e7a1fed4ad49c055ea0d63cd18789efa..ae92290e3c1430901e8b99bed0161689ced5fcda 100644 (file)
@@ -990,21 +990,26 @@ xfs_fs_write_inode(
        struct inode            *inode,
        int                     sync)
 {
+       struct xfs_inode        *ip = XFS_I(inode);
        int                     error = 0;
        int                     flags = 0;
 
-       xfs_itrace_entry(XFS_I(inode));
+       xfs_itrace_entry(ip);
        if (sync) {
-               filemap_fdatawait(inode->i_mapping);
+               error = xfs_wait_on_pages(ip, 0, -1);
+               if (error)
+                       goto out_error;
                flags |= FLUSH_SYNC;
        }
-       error = xfs_inode_flush(XFS_I(inode), flags);
+       error = xfs_inode_flush(ip, flags);
+
+out_error:
        /*
         * if we failed to write out the inode then mark
         * it dirty again so we'll try again later.
         */
        if (error)
-               xfs_mark_inode_dirty_sync(XFS_I(inode));
+               xfs_mark_inode_dirty_sync(ip);
 
        return -error;
 }