Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1617744

[PATCH 4.10 15/81] xfs: update ctime and mtime on clone destinatation inodes

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.10 15/81] xfs: update ctime and mtime on clone destinatation inodes
Date 2017-04-06 11:20 +0200
Message-ID <ttbKb-6Cm-53@gated-at.bofh.it> (permalink)
References <ttbh8-6aP-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Christoph Hellwig <hch@lst.de>

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>

---
 fs/xfs/xfs_reflink.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -955,13 +955,14 @@ STATIC int
 xfs_reflink_update_dest(
 	struct xfs_inode	*dest,
 	xfs_off_t		newlen,
-	xfs_extlen_t		cowextsize)
+	xfs_extlen_t		cowextsize,
+	bool			is_dedupe)
 {
 	struct xfs_mount	*mp = dest->i_mount;
 	struct xfs_trans	*tp;
 	int			error;
 
-	if (newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0)
+	if (is_dedupe && 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);
@@ -982,6 +983,10 @@ xfs_reflink_update_dest(
 		dest->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
 	}
 
+	if (!is_dedupe) {
+		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);
@@ -1295,7 +1300,8 @@ xfs_reflink_remap_range(
 	    !(dest->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
 		cowextsize = src->i_d.di_cowextsize;
 
-	ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize);
+	ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize,
+			is_dedupe);
 
 out_unlock:
 	xfs_iunlock(src, XFS_MMAPLOCK_EXCL);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.10 00/81] 4.10.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
  [PATCH 4.10 06/81] xfs: fix toctou race when locking an inode to access the data map Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
  [PATCH 4.10 02/81] KVM: nVMX: fix nested EPT detection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
  [PATCH 4.10 42/81] mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:10 +0200
  [PATCH 4.10 11/81] xfs: allow unwritten extents in the CoW fork Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
  [PATCH 4.10 18/81] xfs: handle indlen shortage on delalloc extent merge Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
  [PATCH 4.10 16/81] xfs: correct null checks and error processing in xfs_initialize_perag Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
  [PATCH 4.10 10/81] xfs: verify free block header fields Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
  [PATCH 4.10 13/81] xfs: reset b_first_retry_time when clear the retry status of xfs_buf_t Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
  [PATCH 4.10 15/81] xfs: update ctime and mtime on clone destinatation inodes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 11:20 +0200
  Re: [PATCH 4.10 00/81] 4.10.9-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-04-06 20:00 +0200
    Re: [PATCH 4.10 00/81] 4.10.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-06 20:10 +0200
  Re: [PATCH 4.10 00/81] 4.10.9-stable review Guenter Roeck <linux@roeck-us.net> - 2017-04-07 00:00 +0200
    Re: [PATCH 4.10 00/81] 4.10.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-07 10:20 +0200

csiph-web