From mboxrd@z Thu Jan 1 00:00:00 1970 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 8AA19EE57FD for ; Fri, 8 Sep 2023 11:41:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E07E86B00B4; Fri, 8 Sep 2023 07:41:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D911B6B00B5; Fri, 8 Sep 2023 07:41:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C32576B00B6; Fri, 8 Sep 2023 07:41:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B044A6B00B4 for ; Fri, 8 Sep 2023 07:41:51 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 86FA5B46CA for ; Fri, 8 Sep 2023 11:41:51 +0000 (UTC) X-FDA: 81213240822.25.601B6E8 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 4D1B11C0002 for ; Fri, 8 Sep 2023 11:41:49 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hvYP+e5t; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.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=1694173309; 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=GvPh/K6VZhzHxdUpxZjt/g3OHCGVvilEkYqL95ptOWI=; b=X73ZEmlvxwohALWqKQlHFcByueZemJ5S6q+GYmzMVzQoDZQ40mYCnb09Vd3uC5qmLMnfFC 8FvvpLE9ZlXsAq9cw3TRag6wIJduf7YYw8NXaw24Cwl6U9lpX3Hnvi28up2lpP+X3J+YDZ BPGH2P0uBYKSJxuUYsfUJYoFJrNcrdo= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hvYP+e5t; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.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=1694173309; a=rsa-sha256; cv=none; b=cRt390HErmDir+4mXX93DE2ggL4ztbtG1lB1b9x6YtzkuvMO/5ur6nT4QrRArQ/YIbyO2j zbA2d/gWvYXIMhp2TQMQO6sWZa5vBIpkmOW3UDkaBBVin+feZCuco0LmOKwt9z60YmDASK 6gCYeFdgIYSWZkZc352IIxZfQzy+nww= 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 6E9116135B; Fri, 8 Sep 2023 11:41:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DACDC433C8; Fri, 8 Sep 2023 11:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694173307; bh=Th07n2ZiEJs6k4933TKSCYY2PxyWJc5qY0ucWzXC3Gk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=hvYP+e5t0mw5oeIG5WhIGoBSXGvgHI8rCzYUQYWMpxFm+41b19/o7DzyDXW/K25Am f1+gdRDRAZ2Uho2ktUBsnfI5poscWnV1DHgf9JDR0UBbeyGwtK9Qe77djKydKqK7iG WxVVsicdJpV3XN9+2Zo+4r9KRKOQlstOgjRzHATa9nEvz3fNtblmYjfAHhUs1s5bdI a3svBjEf1oE0NWdEgcAWa/0sr4gFcoS8K5btnIk0RqowjjuT2S/UbvbUZM7p9bork/ gPxC3M4/xnLuwmGdgzEyEb65ghFAYdd2q3t7HHy9QW6yySFsxQ5L447IMU8fiT8qj7 5lMhpC9/FfF8A== Message-ID: <0716e97eadc834ac4be97af5d6bbab82c5dc4ac9.camel@kernel.org> Subject: Re: [PATCH 1/2] fs: initialize inode->__i_ctime to the epoch From: Jeff Layton To: Jan Kara Cc: Alexander Viro , Christian Brauner , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Date: Fri, 08 Sep 2023 07:41:45 -0400 In-Reply-To: <20230908104229.5tsr2sn7oyfy53ih@quack3> References: <20230907-ctime-fixes-v1-0-3b74c970d934@kernel.org> <20230907-ctime-fixes-v1-1-3b74c970d934@kernel.org> <20230908104229.5tsr2sn7oyfy53ih@quack3> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Rspamd-Queue-Id: 4D1B11C0002 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ebwm6oxw5xiin5gfk6iooy5xjgpyjjsh X-HE-Tag: 1694173309-981983 X-HE-Meta: U2FsdGVkX1+BLDel0lIGJNk6BViF3S2pH0DBUGJ7WefhQJWtk4wg9blBIsyCNUNV4YyzuoHCQF0ZoEwI6BdAfGzLifobTvH5wBPGWFvBEPi72j7lXBi/FS4wZRF1bGdRFc3/jgr1wDFmlzs2ays7jMik+1JqYXTVvyMn0WKwlAq3KZ6B3ERGmbJ9S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r6/fwVWhxZFFUY7rn7zTupU7iEpx7ya5AvN1JGpNKdtuBFpWWUktxsXEUfl/gN7fqaRqQGGnzUfwbVl5GI3qKDbmJI4avMmJruvXM7xEUxmGEydcz+NQvIk+u2GzVWMskJbe81EvQCRbBrpbwQ0SZrq5NhATzRYBLhM 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: On Fri, 2023-09-08 at 12:42 +0200, Jan Kara wrote: > On Thu 07-09-23 12:33:47, Jeff Layton wrote: > > With the advent of multigrain timestamps, we use inode_set_ctime_curren= t > > 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. > >=20 > > Always initialize the ctime field to the epoch so that the filesystem > > can set the timestamps properly later. > >=20 > > Reported-by: kernel test robot > > Closes: https://lore.kernel.org/oe-lkp/202309071017.a64aca5e-oliver.san= g@intel.com > > Signed-off-by: Jeff Layton >=20 > Looks good but don't you need the same treatment to atime after your patc= h > 2/2? >=20 >=20 I don't think so. Most filesystems are doing something along the lines of this when allocating a new inode: inode->i_atime =3D inode->i_mtime =3D inode_set_ctime_current(inode); ...and I think they pretty much all have to initialize i_atime properly, since someone could stat the inode before an atime update occurs. > > --- > > fs/inode.c | 2 ++ > > 1 file changed, 2 insertions(+) > >=20 > > 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, struc= t inode *inode) > > inode->i_fop =3D &no_open_fops; > > inode->i_ino =3D 0; > > inode->__i_nlink =3D 1; > > + inode->__i_ctime.tv_sec =3D 0; > > + inode->__i_ctime.tv_nsec =3D 0; > > inode->i_opflags =3D 0; > > if (sb->s_xattr) > > inode->i_opflags |=3D IOP_XATTR; > >=20 > > --=20 > > 2.41.0 > >=20 --=20 Jeff Layton