Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=090ffaa55dacea774af9ee378d09e47fb7cea9ff
Commit:     090ffaa55dacea774af9ee378d09e47fb7cea9ff
Parent:     97d848365e603def43c69e160937f073bf9cf02e
Author:     Wendy Cheng <[EMAIL PROTECTED]>
AuthorDate: Wed Jun 27 11:00:03 2007 -0400
Committer:  Steven Whitehouse <[EMAIL PROTECTED]>
CommitDate: Mon Jul 9 08:23:59 2007 +0100

    [GFS2] inode size inconsistency
    
    This should have been part of the NFS patch #1 but somehow I missed it
    when packaging the patches. It is not a critical issue as the others (I
    hope). RHEL 5.1 31.el5 kernel runs fine without this change.
    
    Our truncate code is chopped into two parts, one for vfs inode changes
    (in vmtruncate()) and one of gfs inode (in gfs2_truncatei()). These two
    operatons are, unfortunately, not atomic. So it could happens that
    vmtruncate() succeeds (inode->i_size is changed) but gfs2_truncatei
    fails (say kernel temporarily out of memory). This would leave gfs inode
    i_di.di_size out of sync with vfs inode i_size. It will later confuse
    gfs2_commit_write() if a write is issued. Last time I checked, it will
    cause file corruption.
    
    Signed-off-by: S. Wendy Cheng <[EMAIL PROTECTED]>
    Signed-off-by: Steven Whitehouse <[EMAIL PROTECTED]>
---
 fs/gfs2/ops_inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 84051b9..911c115 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -903,8 +903,8 @@ static int setattr_size(struct inode *inode, struct iattr 
*attr)
        }
 
        error = gfs2_truncatei(ip, attr->ia_size);
-       if (error)
-               return error;
+       if (error && (inode->i_size != ip->i_di.di_size))
+               i_size_write(inode, ip->i_di.di_size);
 
        return error;
 }
-
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