Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3581295rdb; Wed, 13 Sep 2023 17:15:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwpe2TXKL5B/V3vCi6C9x32Xw0KGHUA1WXtZLIrhcNS3FrW7H/Iupi0QJksYoFr0TIxrX7 X-Received: by 2002:a05:6830:268f:b0:6b9:f169:99d with SMTP id l15-20020a056830268f00b006b9f169099dmr6426165otu.2.1694650551313; Wed, 13 Sep 2023 17:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694650551; cv=none; d=google.com; s=arc-20160816; b=IyvTWT8peT77LkyfwmTq9EFb9T+BTFziIzH8LuPAMuFDHn+Bgzrga2SGFiIo+9Q31S HLObJJ95NQrs9CkMAmtMk7ljioqzbXGy3OKLv/6JMAPG7yf1J6XqHQQu8KjnmXBHwK03 PbGzcs9+lh2FpXz1h9Byk206AK1SEJmj1GUtRFNfRY1l0DjUUQxxhN5MjKfV8SRPkC4X U+tv5QbApp5Vl6wyRPO9otePTdz9zTC1Sa5GD2pD7IC6UjYWyMor2J6oynn16+H8lXb9 niBD2WtD5urTZc306stuoSIHlLwusRPplDR0HxKEOoF6OoqNbnfZ7A1xYrfe3uqdY+uD dmqw== 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:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id w20-20020a63fb54000000b005740183f171si231068pgj.758.2023.09.13.17.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 17:15:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; 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:7 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 snail.vger.email (Postfix) with ESMTP id 2593781D7A7B; Wed, 13 Sep 2023 06:33:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240893AbjIMNdj (ORCPT + 99 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 ); 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 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 , Amir Goldstein , Nathan Chancellor , Christian Brauner , Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Layton 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 06:33:53 -0700 (PDT) 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 Signed-off-by: Jeff Layton --- 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