aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-02-06 20:45:51 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-08 03:30:31 -0400
commit67eb7bf836af69b967ab437c6c84e81c4351b957 (patch)
treeceebac53b07151c20c12b16ffb42f9c0e0b6382c
parente060f4884c93eb980c6e2cb3f19bf4b7582fd460 (diff)
xfs: update ctime and mtime on clone destinatation inodes
commit c5ecb42342852892f978572ddc6dca703460f25a upstream. We're changing both metadata and data, so we need to update the timestamps for clone operations. Dedupe on the other hand does not change file data, and only changes invisible metadata so the timestamps should not be updated. This follows existing btrfs behavior. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> [darrick: remove redundant is_dedupe test] Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/xfs/xfs_reflink.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 539a612a02e5..36c07b12189e 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -985,13 +985,14 @@ STATIC int
985xfs_reflink_update_dest( 985xfs_reflink_update_dest(
986 struct xfs_inode *dest, 986 struct xfs_inode *dest,
987 xfs_off_t newlen, 987 xfs_off_t newlen,
988 xfs_extlen_t cowextsize) 988 xfs_extlen_t cowextsize,
989 bool is_dedupe)
989{ 990{
990 struct xfs_mount *mp = dest->i_mount; 991 struct xfs_mount *mp = dest->i_mount;
991 struct xfs_trans *tp; 992 struct xfs_trans *tp;
992 int error; 993 int error;
993 994
994 if (newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0) 995 if (is_dedupe && newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0)
995 return 0; 996 return 0;
996 997
997 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp); 998 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
@@ -1012,6 +1013,10 @@ xfs_reflink_update_dest(
1012 dest->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE; 1013 dest->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
1013 } 1014 }
1014 1015
1016 if (!is_dedupe) {
1017 xfs_trans_ichgtime(tp, dest,
1018 XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
1019 }
1015 xfs_trans_log_inode(tp, dest, XFS_ILOG_CORE); 1020 xfs_trans_log_inode(tp, dest, XFS_ILOG_CORE);
1016 1021
1017 error = xfs_trans_commit(tp); 1022 error = xfs_trans_commit(tp);
@@ -1528,7 +1533,8 @@ xfs_reflink_remap_range(
1528 !(dest->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE)) 1533 !(dest->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
1529 cowextsize = src->i_d.di_cowextsize; 1534 cowextsize = src->i_d.di_cowextsize;
1530 1535
1531 ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize); 1536 ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize,
1537 is_dedupe);
1532 1538
1533out_unlock: 1539out_unlock:
1534 xfs_iunlock(src, XFS_MMAPLOCK_EXCL); 1540 xfs_iunlock(src, XFS_MMAPLOCK_EXCL);