Browse Source

[XFS] Prevent data corruption on extending truncate case from cxfs client

SGI-PV: 942439
SGI-Modid: xfs-linux:xfs-kern:200152a

Signed-off-by: Eric Sandeen <sandeen@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Eric Sandeen 19 years ago
parent
commit
374e2ac337
1 changed files with 3 additions and 1 deletions
  1. 3 1
      fs/xfs/xfs_vnodeops.c

+ 3 - 1
fs/xfs/xfs_vnodeops.c

@@ -626,8 +626,10 @@ xfs_setattr(
 	 */
 	 */
 	if (mask & XFS_AT_SIZE) {
 	if (mask & XFS_AT_SIZE) {
 		code = 0;
 		code = 0;
-		if (vap->va_size > ip->i_d.di_size)
+		if ((vap->va_size > ip->i_d.di_size) && 
+		    (flags & ATTR_NOSIZETOK) == 0) {
 			code = xfs_igrow_start(ip, vap->va_size, credp);
 			code = xfs_igrow_start(ip, vap->va_size, credp);
+		}
 		xfs_iunlock(ip, XFS_ILOCK_EXCL);
 		xfs_iunlock(ip, XFS_ILOCK_EXCL);
 		if (!code)
 		if (!code)
 			code = xfs_itruncate_data(ip, vap->va_size);
 			code = xfs_itruncate_data(ip, vap->va_size);