Skip to content

Commit

Permalink
[XFS] Prevent data corruption on extending truncate case from cxfs cl…
Browse files Browse the repository at this point in the history
…ient

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>
  • Loading branch information
Eric Sandeen authored and Nathan Scott committed Nov 2, 2005
1 parent 4750ddb commit 374e2ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/xfs/xfs_vnodeops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 374e2ac

Please sign in to comment.