From patchwork Tue Jul 25 14:58:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 1812679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=F4odUpMe; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=alZ0gxYy; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R9KvL0Xkpz1yYc for ; Wed, 26 Jul 2023 00:59:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=f7OuYTFBnJw3zead2PmURSVVrWNETgaP1xtDg+Er2gY=; b=F4odUpMeudXZ92 WQSewOicilgfONEre4vgkMCN0cHQI4DiZ82Uo54ds/tUoHrFzeygWocgZr0bC6CuqfmqGv+YWOEKJ LDBAKZEa6HwEbL2lXEYjfsULaRocESo00m/T3FohwETIAhtDI9/eBDjA1SplwHrV7VYneMtr4HX/D NVQG5B2fV/e/O22zLhjEk/AjrtBFRAmeJbESXuu/46mwz1Se1jbN1Vz30/ewOSmEXPuvrWR9eGP8I mBYXYE8qgP/bMCV9Rs7+5811zFqmc7xFqhpfNedwQHuEJ7lJSVHE+ZeejjXMRI6cuKeQ5HHJvvnti jSxL9Xa6uUzCTCs7YD3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOJVZ-007qEq-0m; Tue, 25 Jul 2023 14:59:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOJVU-007q9s-37; Tue, 25 Jul 2023 14:59:26 +0000 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 79AB061782; Tue, 25 Jul 2023 14:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B79EC43391; Tue, 25 Jul 2023 14:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690297163; bh=2wyPg6r9LV0rMw3rwiDdQz97NuQm6trs7Tz3krXz824=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=alZ0gxYy+IkbheJTJP3qA2iEk4eNxl7eSGrfIs+MxZSUI5FjVlgNKYG5ztKp3Air1 gU0wFT7ZCjZL97L1pSzjV2gLHwstvP7MB6Z34if0oOLpUl4yCyGO8lfYx/uM34yD1h 9LZWMe7lIPe5nXOW07yRzmCzjlvxPbX1ZXW44vy0Pu6/7l4Z9vUIrk0XHzxH7FLSn0 Zok2yVBZaZarTyEeN65Qsn24kYQ8HA3DH5VcBZbywjGCZx1K80THvInEU4Q0j5ZfkG j9JBRdKpKVrkp5Bentl7GIljUepcCHIJlPZHHNjpgnyCCT/2W0WCPCo/TCZpXZWlzT vUIjlakd0S9oA== From: Jeff Layton Date: Tue, 25 Jul 2023 10:58:18 -0400 Subject: [PATCH v6 5/7] xfs: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20230725-mgctime-v6-5-a794c2b7abca@kernel.org> References: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> In-Reply-To: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> To: 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 , "Darrick J. Wong" Cc: 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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2386; i=jlayton@kernel.org; h=from:subject:message-id; bh=2wyPg6r9LV0rMw3rwiDdQz97NuQm6trs7Tz3krXz824=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBkv+MkP4yvT+W3sEtTwUyKNN0Eo+qCCd0hAxl+0 h4C0zNUhdGJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZL/jJAAKCRAADmhBGVaC FeBjEACUyo8TVL0skmaKxmt9N9nKbRC1TSdvVtM4yiwxJ8jEsCm89ngnhuv/BuJpe41Lx5wb/iz dmMFWHzJRu2aCWptETR3OPCB2GrAR7iNntPS9+gNC6m+5BqrCE02YO3lUtUaRUAYl5OC8Ri6BBQ OEGhtGXHAEQdKV6DErIItzKARajHjYVOGXQMptrAmfVeqZrMgMdnjXv1BkrB7vTxPnEIiZvpXc6 teMkRXV34FsYAQxvcwm57Mmv+ZzhSEhzQj+7Hi5Fd+/iThWp2ImD7wKtbimsgjidI9ckdD0c5hK 1Xoqn16mf7rIUqDTVbuzYbGQI7meLwVcGOlqdqnPMN1HtuSDkogTkGd77hv9NxndH8aK+N90UKH Ks08xZN4yQjcuR2zIFRUCLsaC33fU+/2m8VEH3iIAIDEuqCogY30aCPWiBS4KwHktS1ry5SwFbm xZAhqbegcfX5h0NU2bjonVVMYypC3Ec8Hxs4E7nRLhsdTAF1PwzkcKRfJjflMTm3AVDbGhzr6a2 iNqi2cULBGY/OkiIc97k83/uxrYZSoRVPtrYbRcPDbTmukKm1rRd6io2dU5p1c3Q6EjIhCyoi2B JMPklYNmRVzbzK/y3yeiwwfKpR8AeSRX5pHEDo1ALd8eLd8NtlYkhsN0E3WvbTaYS8RS42Ee4xk v57B1AdBsJ4Ldbg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230725_075925_095475_22638FB0 X-CRM114-Status: GOOD ( 17.12 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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_ICHGT [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2604:1380:4641:c500:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 Acked-by: Darrick J. Wong --- 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); + 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");