Skip to contentSkip to conversation

xfs: update ctime and mtime on clone destinatation inodes

PATCH Superseded Christoph Hellwig 3 participants 4 messages Feb 2, 2017 XFS filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: update ctime and mtime on clone destinatation inodes

We're changing both metadata and data, so we need to update the
timestamps. This follows existing btrfs behavior.

---
 fs/xfs/xfs_reflink.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/xfs/xfs_reflink.c +1 -3
index d5a2cf2b469b..8877e6f5e35d 100644
@@ -967,9 +967,6 @@ xfs_reflink_update_dest(
 	struct xfs_trans	*tp;
 	int			error;
 
-	if (newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0)
-		return 0;
-
 	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
 	if (error)
 		goto out_error;
@@ -988,6 +985,7 @@ xfs_reflink_update_dest(
 		dest->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
 	}
 
+	xfs_trans_ichgtime(tp, dest, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
 	xfs_trans_log_inode(tp, dest, XFS_ILOG_CORE);
 
 	error = xfs_trans_commit(tp);
Signature · 1 line
2.11.0
#1 lore raw
Quoted 2 lines · Christoph Hellwig

We're changing both metadata and data, so we need to update the
timestamps. This follows existing btrfs behavior.

/me wonders, should the mtime change if we're deduping? We're definitely changing metadata, but we shouldn't be making any user-visible changes to the file data.

--D

Quoted 35 lines
---
 fs/xfs/xfs_reflink.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/xfs/xfs_reflink.c +1 -3
index d5a2cf2b469b..8877e6f5e35d 100644
@@ -967,9 +967,6 @@ xfs_reflink_update_dest(
 	struct xfs_trans	*tp;
 	int			error;
 
-	if (newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0)
-		return 0;
-
 	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
 	if (error)
 		goto out_error;
@@ -988,6 +985,7 @@ xfs_reflink_update_dest(
 		dest->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
 	}
 
+	xfs_trans_ichgtime(tp, dest, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
 	xfs_trans_log_inode(tp, dest, XFS_ILOG_CORE);
 
 	error = xfs_trans_commit(tp);
Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 7 lines · Darrick J. Wong
Quoted 2 lines · Christoph Hellwig

We're changing both metadata and data, so we need to update the
timestamps. This follows existing btrfs behavior.

/me wonders, should the mtime change if we're deduping? We're definitely changing metadata, but we shouldn't be making any user-visible changes to the file data.

Good point - we're hitting this from the dedup path as well. I think we should not be updating mtime for dedupe.

#3 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Darrick J. Wong
Quoted 2 lines · Christoph Hellwig

We're changing both metadata and data, so we need to update the
timestamps. This follows existing btrfs behavior.

/me wonders, should the mtime change if we're deduping? We're definitely changing metadata, but we shouldn't be making any user-visible changes to the file data.

Good point - we're hitting this from the dedup path as well. I think we should not be updating mtime for dedupe.

Since CAP_ADMIN is allowed to dedup to an O_RDONLY dest updating mtime would be even creepier.