From patchwork Thu Sep 7 16:33:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13376612 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C40BEC873E for ; Thu, 7 Sep 2023 16:34:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC4CE8D0007; Thu, 7 Sep 2023 12:34:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A73A38D0003; Thu, 7 Sep 2023 12:34:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C61C8D0007; Thu, 7 Sep 2023 12:34:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 795F58D0003 for ; Thu, 7 Sep 2023 12:34:03 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4D06F80220 for ; Thu, 7 Sep 2023 16:34:03 +0000 (UTC) X-FDA: 81210348366.28.7F2B90B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 9182E8001A for ; Thu, 7 Sep 2023 16:34:01 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hdFbPPEz; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694104441; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hFWbSvgYdd6Oh5/F3WQD9lFbTXpZrvdUYMJO36Y5z+E=; b=DfWlOiuToz4wacIJuODtPGEX3u/gPr20vhS8XwKebFYWRJcuvNgVVjf9XRWgdCtwK9SC77 4F2pRFQmbLUf6V0285qNrAktC5hOSzp4RtMjjQWg9l55Dnx3bAnWEiSAdwGj7jxXdf/Icm ZLvCNvJav+8efF6pNaZKYfYTVLsELaw= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hdFbPPEz; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694104441; a=rsa-sha256; cv=none; b=s2pOnp/2rJZN2nbiO/zxLiyYekNX65NNs+nJ1HYEDLn6FYBQUdM7nDZfyoR5iGV6cPUzxX sFVAKZxmVvRYxBvZtL9wtsr9JU8GttXr6tflIpqR2mYEdBddPL1lTKPslSkMdivfBRCqI4 wdJGgb3SOindZyfNRbOjY/5uLxQroK0= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2753612E8; Thu, 7 Sep 2023 16:34:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 724F9C433CB; Thu, 7 Sep 2023 16:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694104440; bh=JP9tUiLZ6T/k5I6nBBltrDdOGnjoSsJgaiX+JXKr3so=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hdFbPPEzdSggibPtiqud6tUTPGMrh4MM86UWNxl9U3J28kRJoe+NUIQq+qzv2mje6 Ja2aq6qq2GkG+BDPQWzl2bIZr2AYMmYYX0dvu9txwAR4+BmCRL6iQAy+l5BS2KHf9R L7gsz0OgS9poH0dwdoqLJSmHoBhTg83wfdN8XiSGVTxJwtQqvmVnNieX3WtGq7Qxi7 FCTHt945til2Bt8OkSEcyzDaickDMZjoM49bzDucTwOY4Iex0VDRJpj99XZB9yMrvc 7HL/KThu0iddy0hyBBpdZIX105Oq1xfP4aj41OqLFYN4/CHe1Y3crJbtWHCWTcUgVc WvJQz1IJXrm3A== From: Jeff Layton Date: Thu, 07 Sep 2023 12:33:47 -0400 Subject: [PATCH 1/2] fs: initialize inode->__i_ctime to the epoch MIME-Version: 1.0 Message-Id: <20230907-ctime-fixes-v1-1-3b74c970d934@kernel.org> References: <20230907-ctime-fixes-v1-0-3b74c970d934@kernel.org> In-Reply-To: <20230907-ctime-fixes-v1-0-3b74c970d934@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Layton , kernel test robot X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1130; i=jlayton@kernel.org; h=from:subject:message-id; bh=JP9tUiLZ6T/k5I6nBBltrDdOGnjoSsJgaiX+JXKr3so=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBk+ft2F+0r47Otgg6Kb6XEIaO9dJBYAFU8gjygE 8uEhYSQQs2JAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZPn7dgAKCRAADmhBGVaC Fc5OD/0bSZpmszFw2mR0jS9vvjyJK3F4b0SARjnyo1q9za9QbR3U8c8lrWzVlySgIRm6ISqeg+C irV1RBOgwNkJRO3/EnwPLcA0K8UAN1VzTC2pn9M7qy6uaxpRlBsFN67vJcdj6I+lmO2QWeTtkkf lMZqAWOh2lR7jc7LqoFT7/Q0hLd0mWFiqtsw2SsSUNj7kIJ8O/QRbpXEfdwPS2Kp4vXtxBFZ34s uyVJFb9N2ZMnDUJiP6cHCnJ8zkAd/ggrB3G5Ea/ydtkv94vSMnJdmr2JYmnUp4QyrNG0qSID0YH XYiQZtdNX8+RGKgBqo4yvR2jrzy8nYAdtXJfejw++Yg22v9gtG26j2eXD9TZWFrYg9w3iPns1mz WRGVVRFZTlfDxJnZggpAYC/S1kCq9xgc4+gFVwmJYfELyIkG74thIdPu8+RSFGQIfTzarjCCytX LoO0DjJMuDA7fcIq7CHGvrn6XLG7AFr1K13ECVagnzBxBXalayHS+ynyi6Al8lW+JjwnIwwd0d8 DbnQCw/H+jM1pllv2qM00QHrq8zwnNekLI/jcZ9OojuPzfxmBby3hA+imSR8zeZdfwRasO7RNZC twEjfkwQ5XzhrFa1e/DlzOrJC2JW/JAqjeXKtqoLrQ0YUIqE1KyW0qN8Aeb5BvS/kH42jezqvTp kG2YAXIFgW/nmJw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 9182E8001A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: yks8iz8izhq1cckmefted9i6xk76dk3j X-HE-Tag: 1694104441-822212 X-HE-Meta: U2FsdGVkX1+PLaDge3aL2nK9bPsj8OJGfXpsEEPXlY1CmKZ6SpGpw6G3v171/jQ15rn6/fWPIWGks3lxQH1oGleZE6NKKK1uLG4+SyFwVVShpq0HcuG1kO41JVnLrL6/svbB2GwDx4NCxOzEgIMyC/7oDUzMj/8iY9AQHN+apf0MHoOahIs8VucseuaFHnrsF2/WjCfGLikq7Mtykp7Ohu8V7TEYtZCYwduO4+mngrCSgjc9sUkSi2t4Sh96iRJ2lNrvDWT3rw0aMVyPIVaobZqdpkXT00te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wG3UJiqrbtlWYIcCmrcVxfxadVqae3VJxnkBh X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: With the advent of multigrain timestamps, we use inode_set_ctime_current to set the ctime, which can skip updating if the existing ctime appears to be in the future. Because we don't initialize this field at allocation time, that could prevent the ctime from being initialized properly when the inode is instantiated. Always initialize the ctime field to the epoch so that the filesystem can set the timestamps properly later. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202309071017.a64aca5e-oliver.sang@intel.com Signed-off-by: Jeff Layton Reviewed-by: Jan Kara --- fs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index 35fd688168c5..54237f4242ff 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -168,6 +168,8 @@ int inode_init_always(struct super_block *sb, struct inode *inode) inode->i_fop = &no_open_fops; inode->i_ino = 0; inode->__i_nlink = 1; + inode->__i_ctime.tv_sec = 0; + inode->__i_ctime.tv_nsec = 0; inode->i_opflags = 0; if (sb->s_xattr) inode->i_opflags |= IOP_XATTR;