Patch from Alexey Kuznetsov <alexey@sw.ru>
[GFS] bug in gfs truncate

GFS enforces a strange invariant: tree of indirect blocks
must be constructed for all the blocks potentially allocateable
inside inode size. Technically this is a stupid requirement,
but both gfs kernel and user space gfs_fsck consider inodes
with bad size as totally invalid and destroy them.

It means that GFS has to be especially careful to maintain
correct inode size. One point of failure is truncate():
if quota does not allow to grow inode size, it leaves i_size
at wrong value. Subsequent write to inode moves wrong i_size
to disk size and height of tree remains not updated. Such inode
is invalid and it is destroyed by subsequent fsck.

	
diff -urp ../gfs-kmod-0.1.16-orig/gfs-kernel-0.1.16/src/gfs/ops_inode.c gfs-kernel-0.1.16/src/gfs/ops_inode.c
--- ./fs/gfs/ops_inode.c	2007-05-20 19:18:19.000000000 +0400
+++ ./fs/gfs/ops_inode.c	2007-05-20 00:43:03.000000000 +0400
@@ -1395,8 +1507,11 @@ gfs_setattr(struct dentry *dentry, struc
 		}
 
 		error = gfs_truncatei(ip, attr->ia_size, gfs_truncator_page);
-		if (error)
+		if (error) {
+			if (inode->i_size != ip->i_di.di_size)
+				i_size_write(inode, ip->i_di.di_size);
 			goto fail;
+		}
 
 		if ((sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) &&
 		    !gfs_is_jdata(ip))
