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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 7ebbfa0c4f0f..f2c037a9564e 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -660,7 +660,7 @@ xfs_setattr(
660 * vnode and flush it when the file is closed, and 660 * vnode and flush it when the file is closed, and
661 * do not wait the usual (long) time for writeout. 661 * do not wait the usual (long) time for writeout.
662 */ 662 */
663 VTRUNCATE(vp); 663 xfs_iflags_set(ip, XFS_ITRUNCATED);
664 } 664 }
665 /* 665 /*
666 * Have to do this even if the file's size doesn't change. 666 * Have to do this even if the file's size doesn't change.
@@ -1519,6 +1519,8 @@ xfs_release(
1519 return 0; 1519 return 0;
1520 1520
1521 if (!XFS_FORCED_SHUTDOWN(mp)) { 1521 if (!XFS_FORCED_SHUTDOWN(mp)) {
1522 int truncated;
1523
1522 /* 1524 /*
1523 * If we are using filestreams, and we have an unlinked 1525 * If we are using filestreams, and we have an unlinked
1524 * file that we are processing the last close on, then nothing 1526 * file that we are processing the last close on, then nothing
@@ -1539,7 +1541,13 @@ xfs_release(
1539 * significantly reducing the time window where we'd otherwise 1541 * significantly reducing the time window where we'd otherwise
1540 * be exposed to that problem. 1542 * be exposed to that problem.
1541 */ 1543 */
1542 if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0) 1544 spin_lock(&ip->i_flags_lock);
1545 truncated = __xfs_iflags_test(ip, XFS_ITRUNCATED);
1546 if (truncated)
1547 ip->i_flags &= ~XFS_ITRUNCATED;
1548 spin_unlock(&ip->i_flags_lock);
1549
1550 if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
1543 xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE); 1551 xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
1544 } 1552 }
1545 1553