Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2381650ybi; Sat, 25 May 2019 23:13:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQfRJuzbxy/vYutaisI42B9x7wONC8sCAAh/Vsh3dB8tCbpr2QOqOiwQwC87OTVal6g91R X-Received: by 2002:a63:1b56:: with SMTP id b22mr23562617pgm.87.1558851223649; Sat, 25 May 2019 23:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558851223; cv=none; d=google.com; s=arc-20160816; b=GbfvVM9KWPgwBfsCbpn4HMoGt52grvXOvMBeSgFJ8P4oiupoepnOSImqyf+mvAKZiL Z4zfGZVtkfh7QuHDeH6IKA1VlgBOhR0LuXKFGMA7JYXFiqd5EJn98FkeCcqM035UMeBf YxEXmE8nRWFmLNFBCaNp3mANGYqzNYFcpwOmhUtlz5iXxK8M4t4DC3Fx6waeMzdlo9sW DPFk4KToo+gZRnAz4LEBISkGw5rPyFOJweRDTABt9IAhArQfSSHVPLWTjuFA7tolgxvL nIMXlYRCllI0xQxO1p3TZoZkeWV7EkISv4+rCuPIo4352FMvvReUUonce5cIUUmb+nLZ ux0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=DGrN4rR5rYR4+AFEw/yxi4Y2DyPPMShooGDZpQ3nmN4=; b=Rxk6bsUgnc4RJ+hOlGiYIeUIhP1pgczUO30yOPxFfvgi670/mE7qkZczY24+ZrI/l6 +WmOzGDHx3CSchDnOLjgXwNgg2YeKIvY7mjOGeI7I+HA0HyNLOGqke0HSGgUUFEnIBTs sofQHVDimfdcbJxO3sFxi5fpaUHp9aYYttj3vC1QF1GPXHdcDjWRTLaFxz4/91sU5WpC 3tbQO3mJY31igqmmMN0hizYjIIaXokN6rrscc6WQEuRdq0MX2Y22x7beP3OPRr05nWQS a4rCghAfknNdi1TDdPei7yID++5rWJyB5uY4rw5aY0GhpImPbIqvOfOqOj787alrZduv GDEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rXjemcSy; 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 z8si10942844pjq.89.2019.05.25.23.13.29; Sat, 25 May 2019 23:13: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=rXjemcSy; 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 S1726348AbfEZGL0 (ORCPT + 99 others); Sun, 26 May 2019 02:11:26 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39959 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727663AbfEZGLZ (ORCPT ); Sun, 26 May 2019 02:11:25 -0400 Received: by mail-wm1-f66.google.com with SMTP id 15so12692931wmg.5; Sat, 25 May 2019 23:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DGrN4rR5rYR4+AFEw/yxi4Y2DyPPMShooGDZpQ3nmN4=; b=rXjemcSygAWLxWoeAChSHdp5wXZOJhg09otgokpp8YocLyi4Qj/aKs7UVeIp5A86ET ZvJbU57lL/uqFpohmWXlv9g2IBR06+XoeONCKzLI6wCSA36/uq2u/hsg4jhUFSN0OigD sYxA5u1qstHS1D/9j5TC9iAHORGDnxCdfbzWu08e/JCt9F+6bpAruhF5NTEJrxAc2FIC nq9e5EIDdtsj0j+bVdJH2+DU718aYBg9CkACNAkmDlB6M1dm5PrjX/r9k/HR3VVKAaKj qIob7LAvdhUPaKWhBGxZIMLzLX0+F59yo1hjrnm0a+yCNJ4hoZEvY6fnJId/e3HIeLBn Pt7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DGrN4rR5rYR4+AFEw/yxi4Y2DyPPMShooGDZpQ3nmN4=; b=D5IPb2/Ji78Y8h6eFF3LGyyb3gBu/HT2u0dhZlu9VafcYYDKZ1H4FgxaQ0ebK0aTyb J5a6Nm7klw273kaIWAKhMkI4viwBhm5OPMuxp+cwwWxOh+h1BNn13WKhgUSW9Ge+IwP9 icXiNK2Y7x4RZy8Rcsvoc1f6zaTFV8iICvHby8PmNGiIEvcjc3gVDN11OprLUGRgdygG JkldFFw01o3u6DEja9hHSCv1pujjKNvRUpg3kMnuQmdhUAiwDwY5tcHQ2mR39ATeTdlL Envu8wVillIVd1B0T7hjXS06PaDZuHdVH4yeCY4po/NjJkP+MSq2uB4RTa1uxzm27GTR I7CA== X-Gm-Message-State: APjAAAXODhFSa9cLkBiqS0PA4B5FCDri963igT7G5By/jAucn/lw4dgu M+yH3jFdkRChWez1aJ3z4Wc= X-Received: by 2002:a1c:9dc7:: with SMTP id g190mr21200396wme.121.1558851083327; Sat, 25 May 2019 23:11:23 -0700 (PDT) Received: from localhost.localdomain ([5.102.238.208]) by smtp.gmail.com with ESMTPSA id a124sm5302943wmh.3.2019.05.25.23.11.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 May 2019 23:11:22 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Christoph Hellwig , Olga Kornievskaia , Luis Henriques , 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: [PATCH v2 6/8] vfs: copy_file_range should update file timestamps Date: Sun, 26 May 2019 09:10:57 +0300 Message-Id: <20190526061100.21761-7-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190526061100.21761-1-amir73il@gmail.com> References: <20190526061100.21761-1-amir73il@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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. -- 2.17.1