From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 389B4C04EB9 for ; Mon, 3 Dec 2018 18:22:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04E802145D for ; Mon, 3 Dec 2018 18:22:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="GpQv+Krm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04E802145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726876AbeLCSW2 (ORCPT ); Mon, 3 Dec 2018 13:22:28 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51856 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbeLCSW2 (ORCPT ); Mon, 3 Dec 2018 13:22:28 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB3IIVcr033104; Mon, 3 Dec 2018 18:22:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=pR2lTQr6PZ+tCcEjrlQdofnegKSg1lQDiNdPHI49uhw=; b=GpQv+KrmcVXffdqzzr0YuRc2lYWm/LVFCztIkk42tW8PHdMWXNDf6p4PlizqP7qZpZst WlGTGY/ydRB4dSi5lgT5CDfneogOe5ljswikMLOQ4h8Km68UuznmQ/jp6BeRnYLAyvOs xwFq40LWW8AUqvpO6BB5u/1LwhZgsTj9Cx6jyYHA9ezN0PMPA0NKBu7A8/ItvXSxaBQy wf32XuCuceHoFiIy2KD/d6lr2B7u3rXaWDdxmgPShzXCzGOMuIo7M0S9DgFfa13zWcbG HzmfpD8VK5PLakg6WOg/zRx8kNlHFj5Nfk0gkDs7W0hcMro+wSMzW/5gz6x64dwZA0/k SA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2p3hqtr26v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 03 Dec 2018 18:22:20 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wB3IMJmY008882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Dec 2018 18:22:19 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wB3IMJmD003726; Mon, 3 Dec 2018 18:22:19 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 03 Dec 2018 10:22:19 -0800 Date: Mon, 3 Dec 2018 10:22:17 -0800 From: "Darrick J. Wong" To: Olga Kornievskaia Cc: Amir Goldstein , david@fromorbit.com, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-nfs , linux-unionfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org Subject: Re: [PATCH 07/11] vfs: copy_file_range should update file timestamps Message-ID: <20181203182217.GY8125@magnolia> References: <20181203083416.28978-1-david@fromorbit.com> <20181203083416.28978-8-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9096 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812030169 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, Dec 03, 2018 at 12:33:50PM -0500, Olga Kornievskaia wrote: > On Mon, Dec 3, 2018 at 5:47 AM Amir Goldstein wrote: > > > > On Mon, Dec 3, 2018 at 10:34 AM Dave Chinner 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 > > > --- > > > fs/read_write.c | 10 ++++++++++ > > > 1 file changed, 10 insertions(+) > > > > > > diff --git a/fs/read_write.c b/fs/read_write.c > > > index 3b101183ea19..3288db1d5f21 100644 > > > --- a/fs/read_write.c > > > +++ b/fs/read_write.c > > > @@ -1576,6 +1576,16 @@ static ssize_t do_copy_file_range(struct file *file_in, loff_t pos_in, > > > { > > > ssize_t ret; > > > > > > + /* 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; > > > + } > > > + > > > > If there is a consistency about who is responsible of calling file_accessed() > > and file_update_time() it eludes me. grep tells me that they are mostly > > handled by filesystem code or generic helpers called by filesystem code > > and not in the vfs helpers. > > > > FMODE_NOCMTIME seems like an xfs specific flag (for DMAPI?), which > > most generic callers of file_update_time() completely ignore. > > This seems like another argument in favor of leaving the responsibility > > of the timestamp updates to the filesystem. > > > > Maybe I am missing something? > > > > I had similar question before about who is responsible for doing the > checks. I agree that attributes should be updated for the case when no > filesystem support exist for copy_file_range() but this code does it > for all the cases. I also wonder if it's appropriate to update the > attributes before the copy is actually done? The other functions that change file contents (write, clonerange) update mtime and remove suid before initiating the operation. For mtime I think we should maintain consistent behavior, and for suid removal we definitely need to revoke that before we change the file contents. --D > > Thanks, > > Amir.