Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5903c4956f7b429f515ba107d9c04bbbe7ce8f9d
Commit:     5903c4956f7b429f515ba107d9c04bbbe7ce8f9d
Parent:     cc92e7ac8d96418d99f0c31a9a132e9fccc54553
Author:     Lachlan McIlroy <[EMAIL PROTECTED]>
AuthorDate: Fri Sep 14 15:22:08 2007 +1000
Committer:  Tim Shimmin <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 12:18:38 2007 +1000

    [XFS] ensure file size is logged on synchronous writes
    
    Synchronous writes currently log inode changes before syncing pages to
    disk. Since the file size is updated on I/O completion we wont be writing
    out the updated file size and if we crash the file will have the wrong
    size. This change moves the logging after the syncing of the pages to
    ensure we log the correct file size.
    
    SGI-PV: 970334
    SGI-Modid: xfs-linux-melb:xfs-kern:29649a
    
    Signed-off-by: Lachlan McIlroy <[EMAIL PROTECTED]>
    Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Tim Shimmin <[EMAIL PROTECTED]>
---
 fs/xfs/linux-2.6/xfs_lrw.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 5d28440..0f54b10 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -838,20 +838,19 @@ retry:
 
        /* Handle various SYNC-type writes */
        if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) {
-               error = xfs_write_sync_logforce(mp, xip);
-               if (error)
-                       goto out_unlock_internal;
-
+               int error2;
                xfs_rwunlock(xip, locktype);
                if (need_i_mutex)
                        mutex_unlock(&inode->i_mutex);
-
-               error = sync_page_range(inode, mapping, pos, ret);
+               error2 = sync_page_range(inode, mapping, pos, ret);
                if (!error)
-                       error = -ret;
+                       error = error2;
                if (need_i_mutex)
                        mutex_lock(&inode->i_mutex);
                xfs_rwlock(xip, locktype);
+               error2 = xfs_write_sync_logforce(mp, xip);
+               if (!error)
+                       error = error2;
        }
 
  out_unlock_internal:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to