aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index e475e3717eb3..9b8b87fcd4ec 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -444,7 +444,13 @@ xfs_setattr(
444 code = 0; 444 code = 0;
445 if ((vap->va_size > ip->i_size) && 445 if ((vap->va_size > ip->i_size) &&
446 (flags & ATTR_NOSIZETOK) == 0) { 446 (flags & ATTR_NOSIZETOK) == 0) {
447 code = xfs_igrow_start(ip, vap->va_size, credp); 447 /*
448 * Do the first part of growing a file: zero any data
449 * in the last block that is beyond the old EOF. We
450 * need to do this before the inode is joined to the
451 * transaction to modify the i_size.
452 */
453 code = xfs_zero_eof(ip, vap->va_size, ip->i_size);
448 } 454 }
449 xfs_iunlock(ip, XFS_ILOCK_EXCL); 455 xfs_iunlock(ip, XFS_ILOCK_EXCL);
450 456
@@ -512,8 +518,11 @@ xfs_setattr(
512 timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; 518 timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG;
513 519
514 if (vap->va_size > ip->i_size) { 520 if (vap->va_size > ip->i_size) {
515 xfs_igrow_finish(tp, ip, vap->va_size, 521 ip->i_d.di_size = vap->va_size;
516 !(flags & ATTR_DMI)); 522 ip->i_size = vap->va_size;
523 if (!(flags & ATTR_DMI))
524 xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
525 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
517 } else if ((vap->va_size <= ip->i_size) || 526 } else if ((vap->va_size <= ip->i_size) ||
518 ((vap->va_size == 0) && ip->i_d.di_nextents)) { 527 ((vap->va_size == 0) && ip->i_d.di_nextents)) {
519 /* 528 /*