From patchwork Wed May 3 14:20:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13230232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C66CFC77B75 for ; Wed, 3 May 2023 14:20:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbjECOUx (ORCPT ); Wed, 3 May 2023 10:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbjECOUr (ORCPT ); Wed, 3 May 2023 10:20:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C15761A7; Wed, 3 May 2023 07:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B004862DE4; Wed, 3 May 2023 14:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17FBCC433D2; Wed, 3 May 2023 14:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683123645; bh=+ZM+liB0nOC40xQZQZ86xt6fi25JWXDh676GI1IVOtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OzK0qj3iyjj33ep8v0XmPObTk1v223SVrzA0av9ES+PbH+yxPsHca4yVlAiP/nZ5J s7ypPpbr+N586IurGZDou4HezY4YGv2LQiX7qFp8MH28smBMh/Nv1lmLgRtTubzXQc c6vf2NMtFc+hB39X4k4fFPtchaoyoUec4XW7/1MwS03OIfxS+48lpd0q4gb3cMmD85 aldOFPYV57sA32GQ5RXkMdpoS66lInKvESkrVa1DzNeaVO1NpsV/fx+F8jE+uie0bm ElHEAdXHpk1hsrNVH/AHKt1QiMneeeXKLv9BU1SbklBImpppDJD4RmdfrTExd5ub23 LS/h5b5LKx40g== From: Jeff Layton To: Alexander Viro , Christian Brauner , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , Dave Chinner , Chuck Lever Cc: Jan Kara , Amir Goldstein , David Howells , Neil Brown , Matthew Wilcox , Andreas Dilger , Theodore T'so , Chris Mason , Josef Bacik , David Sterba , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 2/6] overlayfs: allow it handle multigrain timestamps Date: Wed, 3 May 2023 10:20:33 -0400 Message-Id: <20230503142037.153531-3-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230503142037.153531-1-jlayton@kernel.org> References: <20230503142037.153531-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Ensure that we strip off the I_CTIME_QUERIED bit when copying up. Signed-off-by: Jeff Layton --- fs/overlayfs/file.c | 7 +++++-- fs/overlayfs/util.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 7c04f033aadd..cad715df8c4e 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -222,6 +222,7 @@ static loff_t ovl_llseek(struct file *file, loff_t offset, int whence) static void ovl_file_accessed(struct file *file) { struct inode *inode, *upperinode; + struct timespec64 ctime, uctime; if (file->f_flags & O_NOATIME) return; @@ -232,10 +233,12 @@ static void ovl_file_accessed(struct file *file) if (!upperinode) return; + ctime = ctime_peek(inode); + uctime = ctime_peek(upperinode); if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) || - !timespec64_equal(&inode->i_ctime, &upperinode->i_ctime))) { + !timespec64_equal(&ctime, &uctime))) { inode->i_mtime = upperinode->i_mtime; - inode->i_ctime = upperinode->i_ctime; + inode->i_ctime = uctime; } touch_atime(&file->f_path); diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 923d66d131c1..f4f9d7e189ef 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -1117,6 +1117,6 @@ void ovl_copyattr(struct inode *inode) inode->i_mode = realinode->i_mode; inode->i_atime = realinode->i_atime; inode->i_mtime = realinode->i_mtime; - inode->i_ctime = realinode->i_ctime; + inode->i_ctime = ctime_peek(realinode); i_size_write(inode, i_size_read(realinode)); }