Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1265650rwo; Wed, 2 Aug 2023 11:07:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSkenACEefZq5qloWNn6TgaTVz7n1EGTVOp9fovNCRhOkU8YzEnaSNznr8M03tJLI3W7Ku X-Received: by 2002:a05:6a20:9151:b0:123:152d:d46b with SMTP id x17-20020a056a20915100b00123152dd46bmr20795584pzc.26.1690999637833; Wed, 02 Aug 2023 11:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690999637; cv=none; d=google.com; s=arc-20160816; b=Zwa4BhhWxhvX426toRe8VSl1+SYsgecBIMdW//9pno2jW6SPTYswTGm1p4hBNmRMuo n0VkEswMGltumXfXLx40KJTatOKI70Rp5Y6J17kSI/dJ9E4PCYD97C1RWpAYKNIRuOzb hjEF4Y08gOEsNZS/Lt7VThv2Q7ri6MpZWIgnMgY/umQUU/SRGissBQhlCOkvz32TfVSv 1z8YpsSXZ/zBTkgdc8CMQHt7m1jK4DkkB6EsDeSdMjlw4stDRB09/BHmv4eCpYuHZB1M yS09ovo3ef0Hq5XQLf1HBDnuuC7JYWjRgwwtsXBh5YN5ZLnGjOGIfjewyY14MQEtWXyj lHmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2TZMOtf0ZCs/XvWGISZdpna3qFprKEVbglDpReQgO5E=; fh=EWL9SMdKiHbNUzH1JSgYq/cl6+bBCXQsbdxHLNlqvp8=; b=xi05haIMhi4Nw5ajqu3oSKiGxYcseLBnVV+xVDdmoMNb98gYCGkH2E05IaQ0QpHibY goLXZRJpCtDOPAkylk+Vsez2yzww/z2j3vBmtzu0zO8P6vz0oxwFrDsVCFBI7/Ppiqnr XfVwDWx7ASndSUfPlShTxps12SBBVUjI8bcyDz3TUAf3cR94crK8BZqvXfv7656ZiDqr SZIUvj/0YnKM2i9ejOB841XGyGxPifth1c1kUtYjMOIHAiRoGmoiPslHGx+DKEWLWyuP 409UtYZjn9AoNH17YGVLOi895qdzemF4ei5HAbS+xZmgTDsDl2L6ZZCjjSWrVV1Pcpkc +zGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mvxuU6kS; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cb11-20020a056a00430b00b00682909b9671si3572518pfb.75.2023.08.02.11.07.03; Wed, 02 Aug 2023 11:07:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mvxuU6kS; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbjHBRt7 (ORCPT + 99 others); Wed, 2 Aug 2023 13:49:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233462AbjHBRtm (ORCPT ); Wed, 2 Aug 2023 13:49:42 -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 DB1A144B8; Wed, 2 Aug 2023 10:49:00 -0700 (PDT) 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 D49F561A81; Wed, 2 Aug 2023 17:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BB32C433C7; Wed, 2 Aug 2023 17:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690998534; bh=llcebvZe/hkTeRKgHM9EKZHOV4OnEZQnmHgz/2BQCWE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mvxuU6kSe40eik5JXODSzEUcQCom178bEIK/ueyoWRpPBYA045brCsn1TKHc//Xbp 0ObmccZq1JK/3BS0VYByWWa5KMlUgDASDUx+Tg3MIvNOAUYxUN5IA3Q6lhJnKpS+Kr sJpmoKfyS9TkkEjB5QiyyKjYqppx1pnxNqB5iMeyjJu+17+GIbmic7cVmXJSuLaPLd 3IndlMaTUYFSp0rFtJkAhEAA+wijtIBWkzROVqk80WuAfa/+5o+BWPM09WvvAR3rkz JrCY5Grb5YAFwp2aCPycS4pLSm1cHlwT5kTUQjtvoINT5B7AR/RvqxCMtj/D0aZcEn M8gGWOmNe33KQ== Date: Wed, 2 Aug 2023 10:48:53 -0700 From: "Darrick J. Wong" To: Jeff Layton Cc: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Chris Mason , Josef Bacik , David Sterba , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Namjae Jeon , Sungjong Seo , Jan Kara , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , OGAWA Hirofumi , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Greg Kroah-Hartman , Tejun Heo , Alexander Viro , Christian Brauner , Trond Myklebust , Anna Schumaker , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Mike Marshall , Martin Brandenburg , Luis Chamberlain , Kees Cook , Iurii Zaikin , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Sergey Senozhatsky , Richard Weinberger , Hans de Goede , Hugh Dickins , Andrew Morton , Dave Chinner , Anthony Iliopoulos , v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v6 5/7] xfs: switch to multigrain timestamps Message-ID: <20230802174853.GC11352@frogsfrogsfrogs> References: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> <20230725-mgctime-v6-5-a794c2b7abca@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725-mgctime-v6-5-a794c2b7abca@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jul 25, 2023 at 10:58:18AM -0400, Jeff Layton wrote: > Enable multigrain timestamps, which should ensure that there is an > apparent change to the timestamp whenever it has been written after > being actively observed via getattr. > > Also, anytime the mtime changes, the ctime must also change, and those > are now the only two options for xfs_trans_ichgtime. Have that function > unconditionally bump the ctime, and ASSERT that XFS_ICHGTIME_CHG is > always set. > > Signed-off-by: Jeff Layton > --- > fs/xfs/libxfs/xfs_trans_inode.c | 6 +++--- > fs/xfs/xfs_iops.c | 4 ++-- > fs/xfs/xfs_super.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c > index 6b2296ff248a..ad22656376d3 100644 > --- a/fs/xfs/libxfs/xfs_trans_inode.c > +++ b/fs/xfs/libxfs/xfs_trans_inode.c > @@ -62,12 +62,12 @@ xfs_trans_ichgtime( > ASSERT(tp); > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); > > - tv = current_time(inode); > + /* If the mtime changes, then ctime must also change */ > + ASSERT(flags & XFS_ICHGTIME_CHG); > > + tv = inode_set_ctime_current(inode); > if (flags & XFS_ICHGTIME_MOD) > inode->i_mtime = tv; > - if (flags & XFS_ICHGTIME_CHG) > - inode_set_ctime_to_ts(inode, tv); > if (flags & XFS_ICHGTIME_CREATE) > ip->i_crtime = tv; > } > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > index 3a9363953ef2..3f89ef5a2820 100644 > --- a/fs/xfs/xfs_iops.c > +++ b/fs/xfs/xfs_iops.c > @@ -573,10 +573,10 @@ xfs_vn_getattr( > stat->gid = vfsgid_into_kgid(vfsgid); > stat->ino = ip->i_ino; > stat->atime = inode->i_atime; > - stat->mtime = inode->i_mtime; > - stat->ctime = inode_get_ctime(inode); > stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); > > + fill_mg_cmtime(request_mask, inode, stat); Huh. I would've thought @stat would come first since that's what we're acting upon, but ... eh. :) If everyone else is ok with the fill_mg_cmtime signature, Acked-by: Darrick J. Wong --D > + > if (xfs_has_v3inodes(mp)) { > if (request_mask & STATX_BTIME) { > stat->result_mask |= STATX_BTIME; > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c > index 818510243130..4b10edb2c972 100644 > --- a/fs/xfs/xfs_super.c > +++ b/fs/xfs/xfs_super.c > @@ -2009,7 +2009,7 @@ static struct file_system_type xfs_fs_type = { > .init_fs_context = xfs_init_fs_context, > .parameters = xfs_fs_parameters, > .kill_sb = kill_block_super, > - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, > + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, > }; > MODULE_ALIAS_FS("xfs"); > > > -- > 2.41.0 >