Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5238007ybi; Tue, 28 May 2019 09:37:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRz4UWxvUwXxtuQIcR+WXGJFR0Hf7WrJgQwSqxNkWz2khk68yQGF4cCh7RpblOdO1AWXKr X-Received: by 2002:a63:1642:: with SMTP id 2mr17306004pgw.230.1559061463041; Tue, 28 May 2019 09:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559061463; cv=none; d=google.com; s=arc-20160816; b=Sov1JHaaWZsX7wL0GycXb+YYCpmdvEdVB8RwBks2+dl3IFS9cJ1KipgATqL7nz5ADP nPNVD4i5UdvfvLU+EnU1TaanQZDmhFCLfidhTStaCLOE/6OGyxrP3W77UHICh/SHs85c J4rMbeb/14hTh5lr7YRxMHiJXxGDUzq0Hmy9Av0ZVij6IpLhaj+1mAwPCtbmssbTBuMx nRI8a5ZuA7amSYEe4H2L1XboboodI+WEYUKVcHfU//oluEQUQv5x1oLJo/bZa7JYpZF2 FoQ4b4m2GVGA9TGwlzOoJBfn2KPWKHavNNj9dpOdtRPsuN/X35+sI/lAcw/TTpGbTUCl 3+fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PYyoMvDm/dXGRe/O4V7JuzdN8o4UlUgeVG3yspmetXo=; b=Cz3zXMhd9zSvx45Dn01/NMn+j5metVvx3rO/BhEo5C/VePIu27OQI/LKj7oYKen6cs Jom/qRSJXza5M2qdZe16ZmgcXgVIcfReWRZTj1Keb0P3P3oOIMGMNxEVsYw/dASMsbNk paQ7hYWgJMODTrLiDO7NjF/QxbVHYNitinxS6Y3gXAXeRRf2OQqWYrnK+eg4QlSl5VGK zBErlKcF3e1otXvZdrFTOLB4llkHV5FV/T8wit0QhuxEhtlf2q3yo7JjXhYYwk+/LYKG pYrULoWb3O9dNolYqgVxzR6l3eXXchiJbJYul8bWV9kNUcw3snETnPZJm8ry3i3hRAPX LtbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VGw9h+5S; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si21405002pgt.255.2019.05.28.09.37.28; Tue, 28 May 2019 09:37:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VGw9h+5S; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726937AbfE1QhI (ORCPT + 99 others); Tue, 28 May 2019 12:37:08 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:36348 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726362AbfE1QhH (ORCPT ); Tue, 28 May 2019 12:37:07 -0400 Received: by mail-yb1-f195.google.com with SMTP id y2so5310828ybo.3; Tue, 28 May 2019 09:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PYyoMvDm/dXGRe/O4V7JuzdN8o4UlUgeVG3yspmetXo=; b=VGw9h+5SH8G2eQBLA4yzErLGp2JcQz5xkbxQhD17r2EyO4n3JzIrewbU9I6o6WONw+ Mugd6wgNJT9XNvgGJT/WIeboXrmaLDPR45HipqdaZbOIVLZcrOLkcglAUq8Kc2QmXlSV s4e7wBZAeV9aFiknfm+jQaohyzMx3FIkXPtYUnMx3UCuonMt/FtPqMBdXuMupYe31rsT MvsTYmpTrm95yu80x68xgVtFk12/7AcIrwnq6iPGNMy8h4BUb9Fo/al5ZshH2YCM5KIU MBHrjChha7QRDMatUFEQhQ2LMObbsKY/AIe7bsF1pqIxjcCsB91CkmJboWNIHzpnS4ew iwPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PYyoMvDm/dXGRe/O4V7JuzdN8o4UlUgeVG3yspmetXo=; b=d/dE1b3H4v6blKnu1qrsoxbbsmsviOI9EFNYjb4Rps2ajHaUXCRFiIAqQwKiYygjji QczPv4xzkJb47T8RfeGhZZAnG5c4KIqr2I3rKECGA694nkexFtl+9SQiKclHUAnAfobF q7skc2ZQDIaKtWxmsJa6NUazOYvcV9tA1RD9gEPTILeSCuj8GeDn4d+qplWydvBJsoLq CnstKHpJeT0i4Q/V8zhqDc16SPHiPtRHvV6LFfQNCK2wFSdS+4AOM8Tn7MI3YXF2BQTQ bAeTE2IGcGrUdcUiEc40yuBdoejUPXO5KzhHE/wZQZQkiMPV+uyiOttqXQ3NieSX7Tom 6lTw== X-Gm-Message-State: APjAAAXU4AXZRr/Q8WpwbEHoOrD44rav7SHW+jjWKkYGnGDrwqksEdFc s4vUiIAlH4yOX216pmcU5YiJsy7OoQWsDQrp0JM= X-Received: by 2002:a25:d946:: with SMTP id q67mr2138643ybg.126.1559061426538; Tue, 28 May 2019 09:37:06 -0700 (PDT) MIME-Version: 1.0 References: <20190526061100.21761-1-amir73il@gmail.com> <20190526061100.21761-7-amir73il@gmail.com> <20190528163020.GF5221@magnolia> In-Reply-To: <20190528163020.GF5221@magnolia> From: Amir Goldstein Date: Tue, 28 May 2019 19:36:55 +0300 Message-ID: Subject: Re: [PATCH v2 6/8] vfs: copy_file_range should update file timestamps To: "Darrick J. Wong" Cc: Dave Chinner , Christoph Hellwig , Olga Kornievskaia , Luis Henriques , Al Viro , linux-fsdevel , linux-xfs , Linux NFS Mailing List , CIFS , ceph-devel@vger.kernel.org, linux-api@vger.kernel.org, Dave Chinner Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, May 28, 2019 at 7:30 PM Darrick J. Wong wrote: > > On Sun, May 26, 2019 at 09:10:57AM +0300, Amir Goldstein wrote: > > From: Dave Chinner > > > > Timestamps are not updated right now, so programs looking for > > timestamp updates for file modifications (like rsync) will not > > detect that files have changed. We are also accessing the source > > data when doing a copy (but not when cloning) so we need to update > > atime on the source file as well. > > > > Signed-off-by: Dave Chinner > > Signed-off-by: Amir Goldstein > > --- > > fs/read_write.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/fs/read_write.c b/fs/read_write.c > > index e16bcafc0da2..4b23a86aacd9 100644 > > --- a/fs/read_write.c > > +++ b/fs/read_write.c > > @@ -1576,6 +1576,16 @@ int generic_copy_file_range_prep(struct file *file_in, struct file *file_out) > > > > WARN_ON_ONCE(!inode_is_locked(file_inode(file_out))); > > > > + /* Update source timestamps, because we are accessing file data */ > > + file_accessed(file_in); > > + > > + /* Update destination timestamps, since we can alter file contents. */ > > + if (!(file_out->f_mode & FMODE_NOCMTIME)) { > > + ret = file_update_time(file_out); > > + if (ret) > > + return ret; > > + } > > + > > /* > > * Clear the security bits if the process is not being run by root. > > * This keeps people from modifying setuid and setgid binaries. > > Should the file_update_time and file_remove_privs calls be factored into > a separate small function to be called by generic_{copy,remap}_range_prep? > Ok. same helper could be called also after copy when inode is not locked throughout the copy. Thanks, Amir.