From: Eric Sandeen Date: Wed, 2 Nov 2005 04:07:34 +0000 (+1100) Subject: [XFS] Prevent data corruption on extending truncate case from cxfs client X-Git-Tag: v2.6.15-rc1~450^2~2^2~26 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=374e2ac33724d1dd432b6c75f9b1adf715c2add7;p=linux-2.6 [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 Signed-off-by: Nathan Scott --- diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 5bf9b2a0b5..b564c1b25e 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c @@ -626,8 +626,10 @@ xfs_setattr( */ if (mask & XFS_AT_SIZE) { 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); + } xfs_iunlock(ip, XFS_ILOCK_EXCL); if (!code) code = xfs_itruncate_data(ip, vap->va_size);