Message ID | 20230913-ctime-v1-1-c6bc509cbc27@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp1096927vqx; Wed, 13 Sep 2023 06:46:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfLn17sxoZebUGOf/Hapbmp2muxEAR4hJDSJUA4xuiRKXCX3qaOjK+VOUlDOXgw5xrX3LL X-Received: by 2002:a05:6a20:3254:b0:13a:6bca:7a84 with SMTP id hm20-20020a056a20325400b0013a6bca7a84mr1824123pzc.44.1694612780340; Wed, 13 Sep 2023 06:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694612780; cv=none; d=google.com; s=arc-20160816; b=vXMHj4xBy7mynW2geukdjJdZ2CqeH3okn7I7zYgE9nF0f0mT/6vQgZgZifT/9oGYNe W7JmKV0ixDSuPx6QCkMl4YJTOTTABINShQWXTja/yX+rYa38NwPB5p5AGaONV/gJ6g/v Zz4z6C58ARtr3GE2iX1JIK5PmDHlwIWIEi8eKnXEuD2KCcJTHQ6bUciMArRatzNo6psX u40j1/wZ1pZfD52yXhD89aimZix8qNx5SIuM5+kEGuiDlEkZkHq/CdR38CG+cqRJxoj1 YPjlCfrJtVpNxDv7sy+H7rdO1ULUD1HkUq3N2d3JhS7/Of7z0wS/KeHMu/rv77PTsl+E Mu0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=zXIHGSXjr9HCf5V2Tn9+oZwVdTMks6g17SNVEVfG6l8=; fh=FXKDoJ6BGfgDYoNzGkcxZnQQWLkAyiiy0iDHvhaxnTU=; b=htdkQA0Db8CYhkbaTS/B7TJndVUPv83SPwhKeN6WKabFe9IZ+BMxT//Fnovp8ireZe XNP/Pg3h61IdekaRZF23ZlI+DPGScPVr/aWTOhNragxS5/dqNoACc5qfP0sbgtSOQgn+ qjdSdDNuxMm+MPFWOmj5GP+/38xUZq5cjitwMQXkGikfG2eKFPts9IMetzM43AAXPlJS KwmGwZOflII/3uza4VBlLB46zmscfee8Tx2pskLVDhF9JNPxkX1oFfL30nxr49Xz84j4 HORPeGluL4haZZGkAnOEMXP/oe+64NiB2i2EkiK5C18PkUIubbdvauw/6qSyarSH14LI t5AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="m/w8vBSx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id ci5-20020a056a0028c500b0068c63ec544asi671415pfb.288.2023.09.13.06.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 06:46:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="m/w8vBSx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A2F1B8360826; Wed, 13 Sep 2023 06:34:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240927AbjIMNdj (ORCPT <rfc822;pwkd43@gmail.com> + 36 others); Wed, 13 Sep 2023 09:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241016AbjIMNdY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Sep 2023 09:33:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E65BD19B6; Wed, 13 Sep 2023 06:33:19 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDA93C433C7; Wed, 13 Sep 2023 13:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694611999; bh=U6rJDc8/HNt2MyKMpa3VX4pGAzI4l/fhGVSjCrFrw7Y=; h=From:Date:Subject:To:Cc:From; b=m/w8vBSxfvwIwNoF+gZag1mEhpB3sRvgkHSPbVTdZCRl9EI1gH50kSfn5VTzzH0uc uIun0Oxa50ODwJ2UCl1o8sbvjU4oF6UCnnlxH4lRpfUjZ8pzlIefcSVfmCFs/lKStB G/8No0HmQLFeRScz+eX1raNBVI+dls0QRUVKl0+5lyWI0TnyveiUVMsd5JoCZ88kEA XEpT8uOTYX7s8ziLcSHcViIvq4/GVkUU/S7loMo+sw1oCji0WWymGebCYWocN8k2HT WTRmQ2vniQwhrPWPz+3RC5cJQg8QEDnD/yskvCRYzWj7s4j1QTA2QMZu3nMnmiU6lj GP23EhTE5eqrw== From: Jeff Layton <jlayton@kernel.org> Date: Wed, 13 Sep 2023 09:33:12 -0400 Subject: [PATCH] overlayfs: set ctime when setting mtime and atime MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230913-ctime-v1-1-c6bc509cbc27@kernel.org> X-B4-Tracking: v=1; b=H4sIABi6AWUC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2MDS0Nj3eSSzNxUXSNLS0NzY3Mzg5QUSyWg2oKi1LTMCrA50bG1tQA8zQ0 +VwAAAA== To: Miklos Szeredi <miklos@szeredi.hu>, Amir Goldstein <amir73il@gmail.com>, Nathan Chancellor <nathan@kernel.org>, Christian Brauner <brauner@kernel.org>, Alexander Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Layton <jlayton@kernel.org> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1513; i=jlayton@kernel.org; h=from:subject:message-id; bh=U6rJDc8/HNt2MyKMpa3VX4pGAzI4l/fhGVSjCrFrw7Y=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlAboee2/mgKjU8JTLm84bfls+24apRnvKTVw2o o2baxy12OiJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZQG6HgAKCRAADmhBGVaC FZy6D/0em1kPDGpqJnR9cNODNrAjXokVlbqEB90ZRVJZs/HbLXOba7IWmkugvKyyOUM1uhEYicv muZGCzeaVVypehN7TDm+tFx8IcLSMRuw3jFS2mA3+vusG+eBNHM3TbfZ59XDYH0A0n5i+J32FPy 1Ur8B90OQZZhQLqQ+Bn4gZxsiqo1E7kmwR7Y7mBOkzSDuc8YbNjeGhR/riv5O8cbafg3Nq6T68Z mG8TK1XS/76DBa+moWMfco3KV+exBxGA8cUXgK9kUphMOy+eZ+5TYExPC30vU+i6zdMkZN0YIDh z0tTEjiq9RbkN9HTbcIgcU0tHwC1x5Ft9yO0cFnoG+ABtQSrJ5P7MosKoob0ne4kfiB5wB15LtV Iq5Nfm8aFAZ4KV3gycblwkq8r/1dW1yFMKuvo36gonabRkaphnhyguafjwT1jwmr6A7VfC7OGjI 4+KBF7NteZckElAN/MDDO2LODYp6hbEDB4PyM4HsA8igfhzkcQRIMY+HMDtro/5YIaVRqU1DfjP aMcrCPKLbfU6oFRhvujOAks9KGNe0pXRb8PzsF06NMb+Q+G2lJMxW3QIRThuO0wFOq4g+PL2YUr XwL5z3yEcFFjiv8UJ39/EX2M4ofKanO68yUYqzUzK8M9591vD/qaBV6O/NvoVV8WJCXCkwh7Q6S XM+A8mynNlCbqHw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Sep 2023 06:34:12 -0700 (PDT) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776930290895245333 X-GMAIL-MSGID: 1776930290895245333 |
Series |
overlayfs: set ctime when setting mtime and atime
|
|
Commit Message
Jeff Layton
Sept. 13, 2023, 1:33 p.m. UTC
Nathan reported that he was seeing the new warning in
setattr_copy_mgtime pop when starting podman containers. Overlayfs is
trying to set the atime and mtime via notify_change without also
setting the ctime.
POSIX states that when the atime and mtime are updated via utimes() that
we must also update the ctime to the current time. The situation with
overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask.
notify_change will fill in the value.
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
The new WARN_ON_ONCE in setattr_copy_mgtime caught a bug! Fix up
overlayfs to ensure that the ctime on the upper inode is also updated
when copying up the atime and mtime.
---
fs/overlayfs/copy_up.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
base-commit: 9cb8e7c86ac793862e7bea7904b3426942bbd7ef
change-id: 20230913-ctime-299173760dd9
Best regards,
Comments
On Wed, 2023-09-13 at 09:33 -0400, Jeff Layton wrote: > Nathan reported that he was seeing the new warning in > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > trying to set the atime and mtime via notify_change without also > setting the ctime. > > POSIX states that when the atime and mtime are updated via utimes() that > we must also update the ctime to the current time. The situation with > overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask. Bah...make that "analogous". > notify_change will fill in the value. > > Reported-by: Nathan Chancellor <nathan@kernel.org> > Signed-off-by: Jeff Layton <jlayton@kernel.org> > --- > The new WARN_ON_ONCE in setattr_copy_mgtime caught a bug! Fix up > overlayfs to ensure that the ctime on the upper inode is also updated > when copying up the atime and mtime. > --- > fs/overlayfs/copy_up.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c > index d1761ec5866a..ada3fcc9c6d5 100644 > --- a/fs/overlayfs/copy_up.c > +++ b/fs/overlayfs/copy_up.c > @@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, > { > struct iattr attr = { > .ia_valid = > - ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, > + ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME, > .ia_atime = stat->atime, > .ia_mtime = stat->mtime, > }; > > --- > base-commit: 9cb8e7c86ac793862e7bea7904b3426942bbd7ef > change-id: 20230913-ctime-299173760dd9 > > Best regards,
On Wed, Sep 13, 2023 at 09:33:12AM -0400, Jeff Layton wrote: > Nathan reported that he was seeing the new warning in > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > trying to set the atime and mtime via notify_change without also > setting the ctime. > > POSIX states that when the atime and mtime are updated via utimes() that > we must also update the ctime to the current time. The situation with > overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask. > notify_change will fill in the value. > > Reported-by: Nathan Chancellor <nathan@kernel.org> > Signed-off-by: Jeff Layton <jlayton@kernel.org> > --- Looks good to me, Acked-by: Christian Brauner <brauner@kernel.org> So we can wait for ovl to upstream this fix next and then we'll delay sending the ctime fixes or we'll take this fixup as well. Just let me know what you all prefer.
On Wed, 2023-09-13 at 18:45 +0200, Christian Brauner wrote: > On Wed, Sep 13, 2023 at 09:33:12AM -0400, Jeff Layton wrote: > > Nathan reported that he was seeing the new warning in > > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > > trying to set the atime and mtime via notify_change without also > > setting the ctime. > > > > POSIX states that when the atime and mtime are updated via utimes() that > > we must also update the ctime to the current time. The situation with > > overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask. > > notify_change will fill in the value. > > > > Reported-by: Nathan Chancellor <nathan@kernel.org> > > Signed-off-by: Jeff Layton <jlayton@kernel.org> > > --- > > Looks good to me, > Acked-by: Christian Brauner <brauner@kernel.org> > > So we can wait for ovl to upstream this fix next and then we'll delay > sending the ctime fixes or we'll take this fixup as well. Just let me > know what you all prefer. No preference here.
On Wed, Sep 13, 2023 at 4:33 PM Jeff Layton <jlayton@kernel.org> wrote: > > Nathan reported that he was seeing the new warning in > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > trying to set the atime and mtime via notify_change without also > setting the ctime. > > POSIX states that when the atime and mtime are updated via utimes() that > we must also update the ctime to the current time. The situation with > overlayfs copy-up is analogous, so add ATTR_CTIME to the bitmask. > notify_change will fill in the value. > IDGI, if ctime always needs to be set along with ATIME / MTIME, why not let notify_change() set the bit instead of assert and fix all the callers? But maybe I am missing something. Anyway, I have no objection to the ovl patch. It's fine by me if Christian applies it to the vfs.ctime branch with my ACK. Thanks, Amir. > Reported-by: Nathan Chancellor <nathan@kernel.org> > Signed-off-by: Jeff Layton <jlayton@kernel.org> > --- > The new WARN_ON_ONCE in setattr_copy_mgtime caught a bug! Fix up > overlayfs to ensure that the ctime on the upper inode is also updated > when copying up the atime and mtime. > --- > fs/overlayfs/copy_up.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c > index d1761ec5866a..ada3fcc9c6d5 100644 > --- a/fs/overlayfs/copy_up.c > +++ b/fs/overlayfs/copy_up.c > @@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, > { > struct iattr attr = { > .ia_valid = > - ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, > + ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME, > .ia_atime = stat->atime, > .ia_mtime = stat->mtime, > }; > > --- > base-commit: 9cb8e7c86ac793862e7bea7904b3426942bbd7ef > change-id: 20230913-ctime-299173760dd9 > > Best regards, > -- > Jeff Layton <jlayton@kernel.org> >
On Wed, Sep 13, 2023 at 09:33:12AM -0400, Jeff Layton wrote: > Nathan reported that he was seeing the new warning in > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > trying to set the atime and mtime via notify_change without also > setting the ctime. > > POSIX states that when the atime and mtime are updated via utimes() that > we must also update the ctime to the current time. The situation with > overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask. > notify_change will fill in the value. > > Reported-by: Nathan Chancellor <nathan@kernel.org> > Signed-off-by: Jeff Layton <jlayton@kernel.org> I applied this patch on top of next-20230913 and I do not see the warning I reported on any of my machines. Thanks for the quick fix! Tested-by: Nathan Chancellor <nathan@kernel.org> > --- > The new WARN_ON_ONCE in setattr_copy_mgtime caught a bug! Fix up > overlayfs to ensure that the ctime on the upper inode is also updated > when copying up the atime and mtime. > --- > fs/overlayfs/copy_up.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c > index d1761ec5866a..ada3fcc9c6d5 100644 > --- a/fs/overlayfs/copy_up.c > +++ b/fs/overlayfs/copy_up.c > @@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, > { > struct iattr attr = { > .ia_valid = > - ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, > + ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME, > .ia_atime = stat->atime, > .ia_mtime = stat->mtime, > }; > > --- > base-commit: 9cb8e7c86ac793862e7bea7904b3426942bbd7ef > change-id: 20230913-ctime-299173760dd9 > > Best regards, > -- > Jeff Layton <jlayton@kernel.org> >
On Wed, 13 Sep 2023 09:33:12 -0400, Jeff Layton wrote: > Nathan reported that he was seeing the new warning in > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > trying to set the atime and mtime via notify_change without also > setting the ctime. > > POSIX states that when the atime and mtime are updated via utimes() that > we must also update the ctime to the current time. The situation with > overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask. > notify_change will fill in the value. > > [...] Applied to the vfs.ctime branch of the vfs/vfs.git tree. Patches in the vfs.ctime branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.ctime [1/1] overlayfs: set ctime when setting mtime and atime https://git.kernel.org/vfs/vfs/c/f8edd3368615
On Wed, 2023-09-13 at 20:36 +0300, Amir Goldstein wrote: > On Wed, Sep 13, 2023 at 4:33 PM Jeff Layton <jlayton@kernel.org> wrote: > > > > Nathan reported that he was seeing the new warning in > > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > > trying to set the atime and mtime via notify_change without also > > setting the ctime. > > > > POSIX states that when the atime and mtime are updated via utimes() that > > we must also update the ctime to the current time. The situation with > > overlayfs copy-up is analogous, so add ATTR_CTIME to the bitmask. > > notify_change will fill in the value. > > > > IDGI, if ctime always needs to be set along with ATIME / MTIME, why not > let notify_change() set the bit instead of assert and fix all the callers? > But maybe I am missing something. > Traditionally notify_change has always been given an explicit mask of attrs to change by the caller. I'm a little hesitant to start putting POSIX policy in there. Still, that may be the better thing to do over the long haul. I think that there are some other bugs in the notify_change callers as well: for instance, cachefiles_adjust_size truncates files, but doesn't update the timestamps. I'm pretty sure that's wrong. I think if we want to change how setattr ctime updates work, we'll probably need to do it in the context of a larger notify_change overhaul. > Anyway, I have no objection to the ovl patch. > It's fine by me if Christian applies it to the vfs.ctime branch with my ACK. > Many thanks! > Thanks, > Amir. > > > Reported-by: Nathan Chancellor <nathan@kernel.org> > > Signed-off-by: Jeff Layton <jlayton@kernel.org> > > --- > > The new WARN_ON_ONCE in setattr_copy_mgtime caught a bug! Fix up > > overlayfs to ensure that the ctime on the upper inode is also updated > > when copying up the atime and mtime. > > --- > > fs/overlayfs/copy_up.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c > > index d1761ec5866a..ada3fcc9c6d5 100644 > > --- a/fs/overlayfs/copy_up.c > > +++ b/fs/overlayfs/copy_up.c > > @@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, > > { > > struct iattr attr = { > > .ia_valid = > > - ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, > > + ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME, > > .ia_atime = stat->atime, > > .ia_mtime = stat->mtime, > > }; > > > > --- > > base-commit: 9cb8e7c86ac793862e7bea7904b3426942bbd7ef > > change-id: 20230913-ctime-299173760dd9 > > > > Best regards, > > -- > > Jeff Layton <jlayton@kernel.org> > >
On Thu, 2023-09-14 at 10:39 +0200, Christian Brauner wrote: > On Wed, 13 Sep 2023 09:33:12 -0400, Jeff Layton wrote: > > Nathan reported that he was seeing the new warning in > > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > > trying to set the atime and mtime via notify_change without also > > setting the ctime. > > > > POSIX states that when the atime and mtime are updated via utimes() that > > we must also update the ctime to the current time. The situation with > > overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask. > > notify_change will fill in the value. > > > > [...] > > Applied to the vfs.ctime branch of the vfs/vfs.git tree. > Patches in the vfs.ctime branch should appear in linux-next soon. > > Please report any outstanding bugs that were missed during review in a > new review to the original patch series allowing us to drop it. > > It's encouraged to provide Acked-bys and Reviewed-bys even though the > patch has now been applied. If possible patch trailers will be updated. > > Note that commit hashes shown below are subject to change due to rebase, > trailer updates or similar. If in doubt, please check the listed branch. > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git > branch: vfs.ctime > > [1/1] overlayfs: set ctime when setting mtime and atime > https://git.kernel.org/vfs/vfs/c/f8edd3368615 Christian, are you still planning to pick up this patch? I saw that it was dropped from linux-next. Since the mgtime patches have been reverted for now, it may be best for this to go in via the overlayfs tree ? Thanks,
On Fri, Sep 22, 2023 at 4:52 PM Jeff Layton <jlayton@kernel.org> wrote: > > On Thu, 2023-09-14 at 10:39 +0200, Christian Brauner wrote: > > On Wed, 13 Sep 2023 09:33:12 -0400, Jeff Layton wrote: > > > Nathan reported that he was seeing the new warning in > > > setattr_copy_mgtime pop when starting podman containers. Overlayfs is > > > trying to set the atime and mtime via notify_change without also > > > setting the ctime. > > > > > > POSIX states that when the atime and mtime are updated via utimes() that > > > we must also update the ctime to the current time. The situation with > > > overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask. > > > notify_change will fill in the value. > > > > > > [...] > > > > Applied to the vfs.ctime branch of the vfs/vfs.git tree. > > Patches in the vfs.ctime branch should appear in linux-next soon. > > > > Please report any outstanding bugs that were missed during review in a > > new review to the original patch series allowing us to drop it. > > > > It's encouraged to provide Acked-bys and Reviewed-bys even though the > > patch has now been applied. If possible patch trailers will be updated. > > > > Note that commit hashes shown below are subject to change due to rebase, > > trailer updates or similar. If in doubt, please check the listed branch. > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git > > branch: vfs.ctime > > > > [1/1] overlayfs: set ctime when setting mtime and atime > > https://git.kernel.org/vfs/vfs/c/f8edd3368615 > > Christian, are you still planning to pick up this patch? I saw that it > was dropped from linux-next. Since the mgtime patches have been reverted > for now, it may be best for this to go in via the overlayfs tree ? I think this is a long standing overlayfs bug fix, so it should go into 6.6 and not wait for 6.7 anyway. Also need to add CC stable (don't think we need to bother with Fixes). I do not have any overlayfs fixes queued ATM. Christian, if you have any pening VFS fixes, you may send it along with them or we could just ask Linus to apply this one directly, so that any mgtime changes that may still happen for 6.7 will already have this fluke fixed. Thanks, Amir.
> Christian, if you have any pening VFS fixes, you may send it along with them > or we could just ask Linus to apply this one directly, so that any mgtime > changes that may still happen for 6.7 will already have this fluke fixed. I'll move the fix from vfs.misc into vfs.fixes now and then send it with the pile of other fixes to Linus this week.
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index d1761ec5866a..ada3fcc9c6d5 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, { struct iattr attr = { .ia_valid = - ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, + ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME, .ia_atime = stat->atime, .ia_mtime = stat->mtime, };