Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3889284ybi; Mon, 27 May 2019 07:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqx842AWexii7bR0Z8Thg/3Lu8YoFhy9PHtcj5RBMNpFyRp6qshzjTYFoNCsATjnSCcAkP81 X-Received: by 2002:a63:6e0b:: with SMTP id j11mr78819440pgc.291.1558967822274; Mon, 27 May 2019 07:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558967822; cv=none; d=google.com; s=arc-20160816; b=j/Q3B5cP2nkwSKHxKqferLjCg6lmM2YvTyXVpLbei+6n8M6GDUOoTmUfVJnn85raxq UCVRISa4rbLWnwX8Z//C2FfK8i679dTFgKtTfZw5vjCQRjqjqVsgMtQi6JdY/R3DdoFV LpXgCGkiRxEhHUB5Ojsr7QzAe/4NUQtgfvlQpBkR59Bnbu4iZ3k6O4P4gL5TW7Qf+Y/X IhN+XE9O3iWHhb62UHhJA23nmjNHmKI1RorkHIhbpHAwrODA/dKYNbOUTf6vnkYvJ3Qs 6vWh+jSpj5zApI8HkBIU8R1Jl3pXq5UGw1di5DkKT+g6Kp10sCzFafuHVV2uPYJZoNs6 4xQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4IaAPb3WgPHXTkJ8bxLSBdvgizs2KdsIHNF/XRqcC3k=; b=yIYE/jlrsFiU7YkEsTuhH+1xicL1P/4K8vwAm4b/jReGvjsLfVyaapskgsx5KVrrpS x71xGVSaKRZ23KLGr568l6FmtrCdHLDcNPbt0NLCtcGHO8rLyIKDuesYWiBJQIuizyIv +dsd6yZjH6wY0sW2JxJjxUozG/fo10/R+cQAxc3Pd/p2GeTxWHc/8Qz0YjTS29c9+qnj LmXn7MhJDNv8lsSUkar3DquKpVp28m1kMh7UOWL92IM5UoHpWiprD7GUxbwtMukuzeDc WUJ5u/Tp55DUYUqTBqV/ym+QK/WWxD1yBPslFYMjt3wxJlycW3LsSz0kQMLXP3yGZIIC 1slQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15si19128482pfh.174.2019.05.27.07.36.39; Mon, 27 May 2019 07:37:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbfE0Ofn (ORCPT + 99 others); Mon, 27 May 2019 10:35:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:43340 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726209AbfE0Ofm (ORCPT ); Mon, 27 May 2019 10:35:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D712FAF10; Mon, 27 May 2019 14:35:40 +0000 (UTC) Date: Mon, 27 May 2019 15:35:39 +0100 From: Luis Henriques To: Amir Goldstein Cc: "Darrick J . Wong" , Dave Chinner , Christoph Hellwig , Olga Kornievskaia , Al Viro , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-api@vger.kernel.org, Dave Chinner Subject: Re: [PATCH v2 6/8] vfs: copy_file_range should update file timestamps Message-ID: <20190527143539.GA14980@hermes.olymp> References: <20190526061100.21761-1-amir73il@gmail.com> <20190526061100.21761-7-amir73il@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190526061100.21761-7-amir73il@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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; > + } > + Is this the right place for updating the timestamps? I see that in same cases we may be updating the timestamp even if there was an error and no copy was performed. For example, if file_remove_privs fails. (btw, I've re-tested everything on ceph and everything seems to be working fine.) Cheers, -- Lu?s > /* > * Clear the security bits if the process is not being run by root. > * This keeps people from modifying setuid and setgid binaries. > -- > 2.17.1 > >