From patchwork Thu Jul 13 23:00:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312716 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 504C7C00528 for ; Thu, 13 Jul 2023 23:01:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F3D66B007B; Thu, 13 Jul 2023 19:01:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A3846B007D; Thu, 13 Jul 2023 19:01:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81E418D0002; Thu, 13 Jul 2023 19:01:19 -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 6FB286B007B for ; Thu, 13 Jul 2023 19:01:19 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 35F01A03DB for ; Thu, 13 Jul 2023 23:01:19 +0000 (UTC) X-FDA: 81008111478.16.7B83C2B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 1984420016 for ; Thu, 13 Jul 2023 23:01:16 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BSkoXvWX; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.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=1689289277; a=rsa-sha256; cv=none; b=uOBoY0jgQ5nCOGEn01bOs3xHLdXFP9vpoC9se73BTJ5QvC8uvNJVLS3R799ZrqawzOgllh piHDoW6Ynqv+TvQR6eOeQsCkvcrJhn5Ybn1ddPD3y2Ly5iFG6cKQNKofw9+q3jYQESj94T wLREF5MJoSiSuN3riRaKc15cYTltM3k= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BSkoXvWX; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.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=1689289277; 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=XHHzY98csxIdhFnUZS5oZpEbnogihcl0Vlct+9xAXs4=; b=VgEMNzMHujFbGAfEv52NbtHRTK3Xq60laOdQptw59Sm7/XqQgoZj3ef77sO5t2UcRiyh9k sV9rGqOARXiCLLFw0xj2IpoU58O3DX7k6R8i3E8b3ZTUxvIsiy1nZN3zRybpM4Z0e+gDl1 CGwhiz3haDlZRw9Qwv7wi1JLpwcNwig= 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 3BE8C61B8A; Thu, 13 Jul 2023 23:01:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96616C43395; Thu, 13 Jul 2023 23:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289275; bh=2vQRXSuM7LMMuFaaZmD2AeyUpwjIbI+L+K8bXPk5DTQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BSkoXvWXcDj/keTS/2FezKassYS4G7pjurSgR4gS3oFBedYTE7p/18Cp+KdB+ucdM 4mWFzICZyqVeE7yU50sw7v3Pg2yUWX7kxzjTd+LyhjyRuPSKVzrHDFUW4T4vW5gDOu k67nHrT+QzJy/IIH+AhVQNVdNPoVCtGakmONlPG/FINGlG1iApR062998MUwUKtSBW OMv+bSvTRPEsnqgWduc0BubAUYwnmkgjEDsMYYFpwpLX0vmZArRuW7FZZLEdWJPAqf zZUpxxkoLp9YAK4q4wf8kQTS6t2TGezKcpTd+D8Vj2uHM1W5FiTUjmICty+IjuzZtJ iCDgynthtTFug== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:50 -0400 Subject: [PATCH v5 1/8] fs: pass the request_mask to generic_fillattr MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-1-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=28167; i=jlayton@kernel.org; h=from:subject:message-id; bh=2vQRXSuM7LMMuFaaZmD2AeyUpwjIbI+L+K8bXPk5DTQ=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIuUFF2EkocwIn0PEum4dQq6wMl4vD6+Cu0s 5K0gYYRpKuJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC FTXMD/9IkuzbPn801fod6VBXDw96bjCgCOSdVGKbPYAr5P7BsWXDH/Ps0bYjnnNoB8yPYZ5PUyw atN4oiUSgPjzuvL1YM4JDP2Jkt4GdHJ7cBNFNDhJuOuRMjlxnfNmeSvACipoolKZPwqrD8PD3vW OiROx+xIwfbjbBhwnsm7Z6d+IN4P7qt+jHYuLRC6YHFACxC/lqHCpFa0735RuRRuQCluK/lu8J0 iUhMeqGZ00FfaMOm2i5bZXV20eG9AwwI7hcm7Bq1Jc/tnzP/Og6nzg8hpp/Ft4KZ2naQOt3KXQ4 PMi/TIaHKug3kMkuCCpDnFYOzTicy6pPn5iCskdiLktNw9TJaWOMj+h3092Nlme+9yElfbDPc3m dwWVdY3O5i90y08x5ONOSGyo00r371tbiAcPteEjUNE6p5vEbWmJdNjDqELsPyFrefG+xZ1j1Qf ZJTT37lJ7PwCXHtJj73+AdySBFULNORqCZy3f7VEqqqMXWwlncZlYph2vCgLKCQ5AKdrQFWrrev 4tIGnMLYEU7T0OF2YEuNOZ/oEKXprzNeHTxk/K9bytnJOaW223Lk1QlAHJ49BKXGd8NkxE8wevN Dv/tC1MVO5hh4jdjqnY4RJSzo486Z+wPvrZjMc01otLdjCwKpVkGdFQJFpDpMBDN+5JGnmGEK0L GToWh/TPH7CmHXg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1984420016 X-Stat-Signature: igs5meh16w6qdot6rcsaxyobumaepq4h X-HE-Tag: 1689289276-136968 X-HE-Meta: U2FsdGVkX19kwLJr1W7S2IBvwJ2TMg03icOMDXV913vKK2/JVi0FKJpAjiuiqmoelreoxd8eM0pvc+EVFveBTn0oWavU0cEQasIaaccIM8Y/BJg9P7qFWboCXsSBuYsuyk74U0LEQOYQ9uAZqN5zQGtTf8k+4UCAZG8v4rXEyzL5/vlKd2ViYRisLaLpJyIoIkWT4ZJFhO+D6rSBkCKh2FEHMRjffnKiDWPNVbiOqTZlHC4C/nFpHYvUkYCLmJCwnnXZwiH3mdxKXfVOi5GouqLTaxIr/kYE2B8g4eHhJJxx214kiPMmSdB6nx+CdSEcETxl9Rwic4T8dLKcI84ZJ8Uei1a3m6ZmU83KtLzVcWXOSwFUoOQKOsOSGOgK2Jr98kq8SCrx8dPt6+sXoLXvRAul0X3dXIUd6aCjCsvCNIiP/7lnNjX1fGq8DAZuXgqHy7Sh6kFDRztSnhHOWD2XQXeQM0Xb3ps9Pql8pwAXpO9Z40w9txnqem/26Q5UQt9642FYyuC8cMX2cCrS/nbOozLUrOiN8sPQVT+zUNmLAiP4luV5+Cj10ObHfvAAqt2ls7T7J2+oXZ5vo7fGrIDKAOX/0SVtgLh36HH5uqv2/02se6h9nQy0GEgN8ehvJLjoVqsU2+IWMgR284CKSSCNBVePBGSYy0U/0JdbEswoeUvPns2u4C+ZlezMUi+VfQ2/zhnoTv6GmEYINYQkY38mK/MCQDViwHm3ZJEHGEPuE7FKuc6fh5CCBO5y7PC+/Y8tyC0R+8DqY+Urco0YuT7uCuMaK4JQzfhAbrnPmTmidQDsmQo72ID7+cdH1k7f9XfyK/si78TrVgrrcgn44+08pvu3pxuEqjXDu4CRaGgUdFDwA95A/R/skNZB/MtUUktrUt2EncrewswnR9MHhe3CX8TiIoLYPHkPzDvcB9fSQ1fOZRtXtSax0TaGg6O9jGVc7p/DaVDc66TCncpUALg Oh8ov6mG lRGhVKyRrsBKnlV8Kicw0Axe+pN3uk4PQL24kqWNQkh5sgGuKh7WkzRzS46LvBeSNNRhbCEYiX7YnIKNMxMskmypcIKiCbx9jcOAJwlRRIMHzG+/Eh9Igw0P/WrWa2XCxpEGmthtxQk/IJgLbmcaHZ8LXSs9XHZpnLb0gjfjI4p5f463Q6v+Uky8QMxv8hIqmqIO0QmVDrhAilEKLH5ISwC+X4paClD6AOFa4w4CfgYKklN5eGYgjD4yQ/zSWfPSe8ERDntQXHKjXSoMs1pxpxkQEZmzo87xfiZal2FcYXl9fjkjNVlq/cKNaoT9oEVVMKoi3nGRg10ZPVwKOizQ9KiA8HQ65ByVXMe/PLWqleyWVSF+JPpheN5wYtnRdDVXBqxN7BhExE09VTa4= 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: generic_fillattr just fills in the entire stat struct indiscriminately today, copying data from the inode. There is at least one attribute (STATX_CHANGE_COOKIE) that can have side effects when it is reported, and we're looking at adding more with the addition of multigrain timestamps. Add a request_mask argument to generic_fillattr and have most callers just pass in the value that is passed to getattr. Have other callers (e.g. ksmbd) just pass in STATX_BASIC_STATS. Also move the setting of STATX_CHANGE_COOKIE into generic_fillattr. Signed-off-by: Jeff Layton --- fs/9p/vfs_inode.c | 4 ++-- fs/9p/vfs_inode_dotl.c | 4 ++-- fs/afs/inode.c | 2 +- fs/btrfs/inode.c | 2 +- fs/ceph/inode.c | 2 +- fs/coda/inode.c | 3 ++- fs/ecryptfs/inode.c | 5 +++-- fs/erofs/inode.c | 2 +- fs/exfat/file.c | 2 +- fs/ext2/inode.c | 2 +- fs/ext4/inode.c | 2 +- fs/f2fs/file.c | 2 +- fs/fat/file.c | 2 +- fs/fuse/dir.c | 2 +- fs/gfs2/inode.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/kernfs/inode.c | 2 +- fs/libfs.c | 4 ++-- fs/minix/inode.c | 2 +- fs/nfs/inode.c | 2 +- fs/nfs/namespace.c | 3 ++- fs/ntfs3/file.c | 2 +- fs/ocfs2/file.c | 2 +- fs/orangefs/inode.c | 2 +- fs/proc/base.c | 4 ++-- fs/proc/fd.c | 2 +- fs/proc/generic.c | 2 +- fs/proc/proc_net.c | 2 +- fs/proc/proc_sysctl.c | 2 +- fs/proc/root.c | 3 ++- fs/smb/client/inode.c | 2 +- fs/smb/server/smb2pdu.c | 22 +++++++++++----------- fs/smb/server/vfs.c | 3 ++- fs/stat.c | 18 ++++++++++-------- fs/sysv/itree.c | 3 ++- fs/ubifs/dir.c | 2 +- fs/udf/symlink.c | 2 +- fs/vboxsf/utils.c | 2 +- include/linux/fs.h | 2 +- mm/shmem.c | 2 +- 40 files changed, 70 insertions(+), 62 deletions(-) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 16d85e6033a3..d24d1f20e922 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -1016,7 +1016,7 @@ v9fs_vfs_getattr(struct mnt_idmap *idmap, const struct path *path, p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); v9ses = v9fs_dentry2v9ses(dentry); if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); return 0; } else if (v9ses->cache & CACHE_WRITEBACK) { if (S_ISREG(inode->i_mode)) { @@ -1037,7 +1037,7 @@ v9fs_vfs_getattr(struct mnt_idmap *idmap, const struct path *path, return PTR_ERR(st); v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb, 0); - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat); p9stat_free(st); kfree(st); diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 464ea73d1bf8..8e8d5d2a13d8 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -451,7 +451,7 @@ v9fs_vfs_getattr_dotl(struct mnt_idmap *idmap, p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); v9ses = v9fs_dentry2v9ses(dentry); if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); return 0; } else if (v9ses->cache) { if (S_ISREG(inode->i_mode)) { @@ -476,7 +476,7 @@ v9fs_vfs_getattr_dotl(struct mnt_idmap *idmap, return PTR_ERR(st); v9fs_stat2inode_dotl(st, d_inode(dentry), 0); - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat); /* Change block size to what the server returned */ stat->blksize = st->st_blksize; diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 6b636f43f548..1c794a1896aa 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -773,7 +773,7 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path, do { read_seqbegin_or_lock(&vnode->cb_lock, &seq); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); if (test_bit(AFS_VNODE_SILLY_DELETED, &vnode->flags) && stat->nlink > 0) stat->nlink -= 1; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ceac62c1cbfc..29a20f828dda 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8746,7 +8746,7 @@ static int btrfs_getattr(struct mnt_idmap *idmap, STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP); - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); stat->dev = BTRFS_I(inode)->root->anon_dev; spin_lock(&BTRFS_I(inode)->lock); diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 5f6e93714f5a..fd05d68e2990 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2467,7 +2467,7 @@ int ceph_getattr(struct mnt_idmap *idmap, const struct path *path, return err; } - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); stat->ino = ceph_present_inode(inode); /* diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 3e64679c1620..0c7c2528791e 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -256,7 +256,8 @@ int coda_getattr(struct mnt_idmap *idmap, const struct path *path, { int err = coda_revalidate_inode(d_inode(path->dentry)); if (!err) - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, + d_inode(path->dentry), stat); return err; } diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index b491bb239c8f..992d9c7e64ae 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -982,7 +982,7 @@ static int ecryptfs_getattr_link(struct mnt_idmap *idmap, mount_crypt_stat = &ecryptfs_superblock_to_private( dentry->d_sb)->mount_crypt_stat; - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat); if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { char *target; size_t targetsiz; @@ -1011,7 +1011,8 @@ static int ecryptfs_getattr(struct mnt_idmap *idmap, if (!rc) { fsstack_copy_attr_all(d_inode(dentry), ecryptfs_inode_to_lower(d_inode(dentry))); - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, + d_inode(dentry), stat); stat->blocks = lower_stat.blocks; } return rc; diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 567c0d305ea4..f3053f0dd6e1 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -368,7 +368,7 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path, stat->attributes_mask |= (STATX_ATTR_COMPRESSED | STATX_ATTR_IMMUTABLE); - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); return 0; } diff --git a/fs/exfat/file.c b/fs/exfat/file.c index f40ecfeee3a4..32395ef686a2 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -232,7 +232,7 @@ int exfat_getattr(struct mnt_idmap *idmap, const struct path *path, struct inode *inode = d_backing_inode(path->dentry); struct exfat_inode_info *ei = EXFAT_I(inode); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); exfat_truncate_atime(&stat->atime); stat->result_mask |= STATX_BTIME; stat->btime.tv_sec = ei->i_crtime.tv_sec; diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 1259995977d2..acbab27fe957 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -1628,7 +1628,7 @@ int ext2_getattr(struct mnt_idmap *idmap, const struct path *path, STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); return 0; } diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 86696b40c58f..6683076ecb2f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5535,7 +5535,7 @@ int ext4_getattr(struct mnt_idmap *idmap, const struct path *path, STATX_ATTR_NODUMP | STATX_ATTR_VERITY); - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); return 0; } diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index b018800223c4..35886a52edfb 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -882,7 +882,7 @@ int f2fs_getattr(struct mnt_idmap *idmap, const struct path *path, STATX_ATTR_NODUMP | STATX_ATTR_VERITY); - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); /* we need to show initial sectors used for inline_data/dentries */ if ((S_ISREG(inode->i_mode) && f2fs_has_inline_data(inode)) || diff --git a/fs/fat/file.c b/fs/fat/file.c index 456477946dd9..e887e9ab7472 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c @@ -401,7 +401,7 @@ int fat_getattr(struct mnt_idmap *idmap, const struct path *path, struct inode *inode = d_inode(path->dentry); struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); stat->blksize = sbi->cluster_size; if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) { diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index a210c231c7d3..645fae48dc6b 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1224,7 +1224,7 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file, forget_all_cached_acls(inode); err = fuse_do_getattr(inode, stat, file); } else if (stat) { - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); stat->mode = fi->orig_i_mode; stat->ino = fi->orig_ino; } diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 2ded6c813f20..200cabf3b393 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -2071,7 +2071,7 @@ static int gfs2_getattr(struct mnt_idmap *idmap, STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); if (gfs2_holder_initialized(&gh)) gfs2_glock_dq_uninit(&gh); diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 40c61ab4a918..c65c8c4b03dd 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -298,7 +298,7 @@ int hfsplus_getattr(struct mnt_idmap *idmap, const struct path *path, stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP; - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); return 0; } diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index 89a9b4dcf109..af37be68bf06 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -190,7 +190,7 @@ int kernfs_iop_getattr(struct mnt_idmap *idmap, down_read(&root->kernfs_iattr_rwsem); kernfs_refresh_inode(kn, inode); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); up_read(&root->kernfs_iattr_rwsem); return 0; diff --git a/fs/libfs.c b/fs/libfs.c index 4a17735aa6ad..0146b9c69029 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -33,7 +33,7 @@ int simple_getattr(struct mnt_idmap *idmap, const struct path *path, unsigned int query_flags) { struct inode *inode = d_inode(path->dentry); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); stat->blocks = inode->i_mapping->nrpages << (PAGE_SHIFT - 9); return 0; } @@ -1582,7 +1582,7 @@ static int empty_dir_getattr(struct mnt_idmap *idmap, u32 request_mask, unsigned int query_flags) { struct inode *inode = d_inode(path->dentry); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); return 0; } diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 8a4fc9420b36..df575473c1cc 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -656,7 +656,7 @@ int minix_getattr(struct mnt_idmap *idmap, const struct path *path, struct super_block *sb = path->dentry->d_sb; struct inode *inode = d_inode(path->dentry); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); if (INODE_VERSION(inode) == MINIX_V1) stat->blocks = (BLOCK_SIZE / 512) * V1_minix_blocks(stat->size, sb); else diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 1283fdfa4b0a..e21c073158e5 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -912,7 +912,7 @@ int nfs_getattr(struct mnt_idmap *idmap, const struct path *path, /* Only return attributes that were revalidated. */ stat->result_mask = nfs_get_valid_attrmask(inode) | request_mask; - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); stat->change_cookie = inode_peek_iversion_raw(inode); stat->attributes_mask |= STATX_ATTR_CHANGE_MONOTONIC; diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 19d51ebf842c..e7494cdd957e 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -215,7 +215,8 @@ nfs_namespace_getattr(struct mnt_idmap *idmap, if (NFS_FH(d_inode(path->dentry))->size != 0) return nfs_getattr(idmap, path, stat, request_mask, query_flags); - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry), + stat); return 0; } diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 12788601dc84..962f12ce6c0a 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -85,7 +85,7 @@ int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path, stat->attributes_mask |= STATX_ATTR_COMPRESSED | STATX_ATTR_ENCRYPTED; - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); stat->result_mask |= STATX_BTIME; stat->btime = ni->i_crtime; diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1b337ebce4df..8184499ae7a5 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1319,7 +1319,7 @@ int ocfs2_getattr(struct mnt_idmap *idmap, const struct path *path, goto bail; } - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); /* * If there is inline data in the inode, the inode will normally not * have data blocks allocated (it may have an external xattr block). diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 9014bbcc8031..a52c30e80f45 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -871,7 +871,7 @@ int orangefs_getattr(struct mnt_idmap *idmap, const struct path *path, ret = orangefs_inode_getattr(inode, request_mask & STATX_SIZE ? ORANGEFS_GETATTR_SIZE : 0); if (ret == 0) { - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); /* override block size reported to stat */ if (!(request_mask & STATX_SIZE)) diff --git a/fs/proc/base.c b/fs/proc/base.c index d8388fc0a362..2bf67a0e0bcc 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1966,7 +1966,7 @@ int pid_getattr(struct mnt_idmap *idmap, const struct path *path, struct proc_fs_info *fs_info = proc_sb_info(inode->i_sb); struct task_struct *task; - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); stat->uid = GLOBAL_ROOT_UID; stat->gid = GLOBAL_ROOT_GID; @@ -3900,7 +3900,7 @@ static int proc_task_getattr(struct mnt_idmap *idmap, { struct inode *inode = d_inode(path->dentry); struct task_struct *p = get_proc_task(inode); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); if (p) { stat->nlink += get_nr_threads(p); diff --git a/fs/proc/fd.c b/fs/proc/fd.c index b3140deebbbf..6276b3938842 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c @@ -352,7 +352,7 @@ static int proc_fd_getattr(struct mnt_idmap *idmap, struct inode *inode = d_inode(path->dentry); int rv = 0; - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); /* If it's a directory, put the number of open fds there */ if (S_ISDIR(inode->i_mode)) { diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 42ae38ff6e7e..775ce0bcf08c 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -146,7 +146,7 @@ static int proc_getattr(struct mnt_idmap *idmap, } } - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); return 0; } diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 78f9e6b469c0..2ba31b6d68c0 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c @@ -308,7 +308,7 @@ static int proc_tgid_net_getattr(struct mnt_idmap *idmap, net = get_proc_task_net(inode); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); if (net != NULL) { stat->nlink = net->proc_net->nlink; diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 6bc10e7e0ff7..bf06344a42cc 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -849,7 +849,7 @@ static int proc_sys_getattr(struct mnt_idmap *idmap, if (IS_ERR(head)) return PTR_ERR(head); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); if (table) stat->mode = (stat->mode & S_IFMT) | table->mode; diff --git a/fs/proc/root.c b/fs/proc/root.c index a86e65a608da..9191248f2dac 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -314,7 +314,8 @@ static int proc_root_getattr(struct mnt_idmap *idmap, const struct path *path, struct kstat *stat, u32 request_mask, unsigned int query_flags) { - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry), + stat); stat->nlink = proc_root.nlink + nr_processes(); return 0; } diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index 218f03dd3f52..93fe43789d7a 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -2540,7 +2540,7 @@ int cifs_getattr(struct mnt_idmap *idmap, const struct path *path, return rc; } - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); stat->blksize = cifs_sb->ctx->bsize; stat->ino = CIFS_I(inode)->uniqueid; diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index f9099831c8ff..2a084d35233a 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -4391,8 +4391,8 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp, } basic_info = (struct smb2_file_basic_info *)rsp->Buffer; - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), - &stat); + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, + file_inode(fp->filp), &stat); basic_info->CreationTime = cpu_to_le64(fp->create_time); time = ksmbd_UnixTimeToNT(stat.atime); basic_info->LastAccessTime = cpu_to_le64(time); @@ -4417,7 +4417,7 @@ static void get_file_standard_info(struct smb2_query_info_rsp *rsp, struct kstat stat; inode = file_inode(fp->filp); - generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat); + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat); sinfo = (struct smb2_file_standard_info *)rsp->Buffer; delete_pending = ksmbd_inode_pending_delete(fp); @@ -4471,7 +4471,7 @@ static int get_file_all_info(struct ksmbd_work *work, return PTR_ERR(filename); inode = file_inode(fp->filp); - generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat); + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat); ksmbd_debug(SMB, "filename = %s\n", filename); delete_pending = ksmbd_inode_pending_delete(fp); @@ -4548,8 +4548,8 @@ static void get_file_stream_info(struct ksmbd_work *work, int buf_free_len; struct smb2_query_info_req *req = ksmbd_req_buf_next(work); - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), - &stat); + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, + file_inode(fp->filp), &stat); file_info = (struct smb2_file_stream_info *)rsp->Buffer; buf_free_len = @@ -4639,8 +4639,8 @@ static void get_file_internal_info(struct smb2_query_info_rsp *rsp, struct smb2_file_internal_info *file_info; struct kstat stat; - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), - &stat); + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, + file_inode(fp->filp), &stat); file_info = (struct smb2_file_internal_info *)rsp->Buffer; file_info->IndexNumber = cpu_to_le64(stat.ino); rsp->OutputBufferLength = @@ -4665,7 +4665,7 @@ static int get_file_network_open_info(struct smb2_query_info_rsp *rsp, file_info = (struct smb2_file_ntwrk_info *)rsp->Buffer; inode = file_inode(fp->filp); - generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat); + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat); file_info->CreationTime = cpu_to_le64(fp->create_time); time = ksmbd_UnixTimeToNT(stat.atime); @@ -4726,8 +4726,8 @@ static void get_file_compression_info(struct smb2_query_info_rsp *rsp, struct smb2_file_comp_info *file_info; struct kstat stat; - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), - &stat); + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, + file_inode(fp->filp), &stat); file_info = (struct smb2_file_comp_info *)rsp->Buffer; file_info->CompressedFileSize = cpu_to_le64(stat.blocks << 9); diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c index e35914457350..d0e94b73931a 100644 --- a/fs/smb/server/vfs.c +++ b/fs/smb/server/vfs.c @@ -1650,7 +1650,8 @@ int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work, u64 time; int rc; - generic_fillattr(idmap, d_inode(dentry), ksmbd_kstat->kstat); + generic_fillattr(idmap, STATX_BASIC_STATS, d_inode(dentry), + ksmbd_kstat->kstat); time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->ctime); ksmbd_kstat->create_time = time; diff --git a/fs/stat.c b/fs/stat.c index 8c2b30af19f5..062f311b5386 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -29,6 +29,7 @@ /** * generic_fillattr - Fill in the basic attributes from the inode struct * @idmap: idmap of the mount the inode was found from + * @req_mask statx request_mask * @inode: Inode to use as the source * @stat: Where to fill in the attributes * @@ -42,8 +43,8 @@ * uid and gid filds. On non-idmapped mounts or if permission checking is to be * performed on the raw inode simply passs @nop_mnt_idmap. */ -void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode, - struct kstat *stat) +void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask, + struct inode *inode, struct kstat *stat) { vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode); vfsgid_t vfsgid = i_gid_into_vfsgid(idmap, inode); @@ -61,6 +62,12 @@ void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode, stat->ctime = inode_get_ctime(inode); stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; + + if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) { + stat->result_mask |= STATX_CHANGE_COOKIE; + stat->change_cookie = inode_query_iversion(inode); + } + } EXPORT_SYMBOL(generic_fillattr); @@ -123,17 +130,12 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat, stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT | STATX_ATTR_DAX); - if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) { - stat->result_mask |= STATX_CHANGE_COOKIE; - stat->change_cookie = inode_query_iversion(inode); - } - idmap = mnt_idmap(path->mnt); if (inode->i_op->getattr) return inode->i_op->getattr(idmap, path, stat, request_mask, query_flags); - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); return 0; } EXPORT_SYMBOL(vfs_getattr_nosec); diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c index dba6a2ef26f1..edb94e55de8e 100644 --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c @@ -449,7 +449,8 @@ int sysv_getattr(struct mnt_idmap *idmap, const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags) { struct super_block *s = path->dentry->d_sb; - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry), + stat); stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); stat->blksize = s->s_blocksize; return 0; diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 3a1ba8ba308a..2f48c58d47cd 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -1654,7 +1654,7 @@ int ubifs_getattr(struct mnt_idmap *idmap, const struct path *path, STATX_ATTR_ENCRYPTED | STATX_ATTR_IMMUTABLE); - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); stat->blksize = UBIFS_BLOCK_SIZE; stat->size = ui->ui_size; diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index 779b5c2c75f6..f7eaf7b14594 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c @@ -149,7 +149,7 @@ static int udf_symlink_getattr(struct mnt_idmap *idmap, struct inode *inode = d_backing_inode(dentry); struct page *page; - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); page = read_mapping_page(inode->i_mapping, 0, NULL); if (IS_ERR(page)) return PTR_ERR(page); diff --git a/fs/vboxsf/utils.c b/fs/vboxsf/utils.c index 576b91d571c5..83f20dd15522 100644 --- a/fs/vboxsf/utils.c +++ b/fs/vboxsf/utils.c @@ -252,7 +252,7 @@ int vboxsf_getattr(struct mnt_idmap *idmap, const struct path *path, if (err) return err; - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), kstat); + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), kstat); return 0; } diff --git a/include/linux/fs.h b/include/linux/fs.h index 39076ea6a360..42d1434cc427 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2919,7 +2919,7 @@ extern void page_put_link(void *); extern int page_symlink(struct inode *inode, const char *symname, int len); extern const struct inode_operations page_symlink_inode_operations; extern void kfree_link(void *); -void generic_fillattr(struct mnt_idmap *, struct inode *, struct kstat *); +void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *); void generic_fill_statx_attr(struct inode *inode, struct kstat *stat); extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int); extern int vfs_getattr(const struct path *, struct kstat *, u32, unsigned int); diff --git a/mm/shmem.c b/mm/shmem.c index 310b0544eae3..b154af49d2df 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1073,7 +1073,7 @@ static int shmem_getattr(struct mnt_idmap *idmap, stat->attributes_mask |= (STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP); - generic_fillattr(idmap, inode, stat); + generic_fillattr(idmap, request_mask, inode, stat); if (shmem_is_huge(inode, 0, false, NULL, 0)) stat->blksize = HPAGE_PMD_SIZE; From patchwork Thu Jul 13 23:00:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312717 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 49D4EC001B0 for ; Thu, 13 Jul 2023 23:01:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7AB06B007D; Thu, 13 Jul 2023 19:01:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B2A828D0002; Thu, 13 Jul 2023 19:01:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A5006B0080; Thu, 13 Jul 2023 19:01:25 -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 8C1076B007D for ; Thu, 13 Jul 2023 19:01:25 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4FF521A03BB for ; Thu, 13 Jul 2023 23:01:25 +0000 (UTC) X-FDA: 81008111730.04.DD27CB1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 86BFF40028 for ; Thu, 13 Jul 2023 23:01:23 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=B0VXtoar; spf=pass (imf17.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689289283; a=rsa-sha256; cv=none; b=pGO0v5kVxNDg9UdGLfZikyMWR/k6WqXg/Cz6Cnb/qgC3EBkJ9wycxVTzkPnqOABmYE1HXj wO7RZmU30EEx49fL9hvxLqTPshwWFS+X4mlytenSRm5+5qL82QIdpWBQF7PAwx1tWTxsee 66maelwqJjJKj2BbXpecqAPYLR4hxM4= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=B0VXtoar; spf=pass (imf17.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689289283; 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=B/0oagySbS3Ifk2UJ6Hmx4LuRWkoKIToXNE7lkONKcc=; b=ByruLmwrmOiyuRyOtxm4am+AdYeUwYJ1+oXW6O6r7wgEWHFHEkE8JfB/GFomtDL4BGfG5z 4pigesAqGUX6o4q++k1IIOV+SJKOKI/T/y/q7kzx63GdO7uYdNrr/NvREbJ3YeLUP+Myh9 XVm+nFjhBnLzH49f/F+2LPzIxY7QK0E= 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 7D8C461AD2; Thu, 13 Jul 2023 23:01:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB019C433B6; Thu, 13 Jul 2023 23:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289281; bh=Dy0ObexSdjvGFnE5GNrBxiftdRymvhQ5lbJx72BKffY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=B0VXtoarm7to3z75jta+r86rymInA0rcOZXXK6PDKyjttw0yeeQ9Oa/YGe0WPfeLw Aqagg2qZGm2iD6O77zF6UEpGttkdBeZ1KtYNAK7yCsHmbrkDzuuzwIxPLcP4GO43wI w39CalEOT65TGDELmucNcEdz39fGNSEIdSWn3pWnfkNQrJywJdCraylNm9TttY5Jra pGZ/outKj00jmCqSJqFF6+vMYT/UgsykUhifnnNjDCMaq/UK/yjZqJD95sei8IkN69 Yjpg4lSMArs8ujYS9j9CZbgze6idfR5gLc5rQLXioEN5xsUXGMQdyyJnSBdudTqHOd n9mfYLATGMhVA== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:51 -0400 Subject: [PATCH v5 2/8] fs: add infrastructure for multigrain timestamps MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-2-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=12090; i=jlayton@kernel.org; h=from:subject:message-id; bh=Dy0ObexSdjvGFnE5GNrBxiftdRymvhQ5lbJx72BKffY=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIuQ6/aMqdFkrW889tZd28XDGD/NKP3ZyaCk jSGPEQm+rOJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC Fa3EEACPAYF/UdPqY2NWkaVzk8H/NAcHUW/hPvIS9vjNZruwFmXFj/LYyMvcp0tofMwLRgMcCAE Vph+wO/c807cLy5llDvTlTm0TjzPef3az0VN3Q8Gzb/2Nnh81yJnaQqOzRwFI1Dobw4ieNMzoU6 4toolNwW0tdDD7IU/urQP+4n7wFZT9iHmcto7q5Ef6rFla5COdzyRUSOPKFltzFKgjBiF2ZUbi1 9rPgV9imtCZWp7fH8mkRIVmoRaIrx24GtSlBnp/pBU+0KzjVNXDvvnegezzxutC4fSPJuW2h5pZ PiakxgsAa14RATd/5YXrIc+yNNZfeC0pRUmGgHOGL10njpjBp7Vo0nCcxoKc1I2kDO9N0tnniRi QyijUzdhFi4tOGbKQFjGi7GTuQekgkvLj3T2CiHuUcXH4phso83iPzj97egR0thkirGb6Cvv/CY uy76MlvwYeCIYaBQkk7dZtQOpLjIjI239VoHsf8OgmrImV9FVxAoJ4yB0PhSCnXl1crVKzEUphQ eemlORwSpndKSNmSnOacohNIRXM4Mqzq1NZM/oJVsRkcHkTc2M6q3C/agLX+m3kKOnc5xOjo8Cm Oq7V4ramHqhM83+/svEq1p6QVyO5KLsFUjSv20Q208e+yhCjvDrQ7s4NNP/Yqb8o/hZn8Clw7W2 cnsnAuyIF+Bo72A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 86BFF40028 X-Stat-Signature: xmwstw3thqt1crubkc67frbnra3xfoj9 X-Rspam-User: X-HE-Tag: 1689289283-851362 X-HE-Meta: U2FsdGVkX1/ELBA46IhxNJ0Ie/ZILA/Dv1G8PG//q6CRy9Kg3h+lvbz+4pK4zUWKp44pcS9dpDHhDnhSO/ncFYVHDdl64mrVqkP8b6d/hUFDHsCggHevDBRPS3xafQQrnHQ+T/c2EtKTvApPy+qpOd4/aaeavT+B9LlBR6Ha9E7BgPnQh18jfoNfBGESKIjdAhKAmPxVKwMTMA8TIcQhYitSS5rlF5M0IZbmq8wAI5jQoW+GsuccJHEDv881STz4wVufDjPGNZLA/86fmKjALLnWr+yKxUDbITVhz0FrVPn1r3pJJKYOscR7rhRN0PD9eSD0TzHaxpGtU24iBjitESm+LNJ2Vk0W7SLUtcCFUY1nC091LuA8YSmYR6mu8O0FV2aV6ucJrnFHbHpjSxonbNBhxfPXV6EjYiZaJLctznw4KO0yBvfdsqctpF8OsH81ihtTeUeCN47cnMCKGniobPVxQYjBQ0oIxtMsEu+wGOJJagOH0RQL42D3FYH2OJowoCuFNMqlO3JW7lFvxhh8ohwXkM1NAcyLzR8EJxJ5P1Qk9KnDgL5W5f6+rrX3IHm5DSdZvCMgTDZJXoik82CEnIhMhb51uWECHIpbhZvP3VHKqEce6PfWvzhoOYflc6GEQBmWNXGKFtB8/p45P5fFJI2ksxT9vQ+HEuByUZ2W2nNx03HlsZVjG6BwPr4uH1SF69WOrh2F7KP69z0HQKRnq1QLNUpB1OFoKUt0blMDx3EfazJY+/clzVbv9mF9EW49vp6pj/s6ngCepM6QXn8JXoFTrQon7UYMYEWTg1F3SCoJaKInaZYjntCmQn8+DHgNPn6pxw46MZG48DTOee6oFt56SvzN7KVjBeNwrh//bIBz7kJTSOXzg3cI2P6AAwD1yl42qhC7iGPi5GSgJS2eWp8pnrt6EXwQ454D3N2xClcP+C5bskADV5JmwusV1VA1jj4BlyPwwZ5QT2FxCkg 8cJx+LYX xkuY/aTFs/Q8gwMig32V0WH+p3epj8Ef9cwOfiBZhWfUIs0r6tPwyKjm/BYexAXXRGlxuEOtqZS+FkaIv1i88kMv7UKUiV6C35BPCyE9tGIXBO+/4aNk60FQzl4wK5tZu5gfn59anecDj0rK/4+78EEftwbcfNBR3AffJf1oao/ypD8yczQHD5g1TA+FPFcjlSkGWkbQCfejtJXFt+PXiGH7e66nufBC0L9VubytkGCCc1+qCXrHLQpQcomGwdS6k22PnTkgmsJMPCZkVWUAjD23jSUCrCWORiCTs0HbUo8nkBkr22jl9wB5aXY+vz9aHOnRBIN9yqcEVSut5uPgvlJ8jtnnwyYh/WLlT 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: The VFS always uses coarse-grained timestamps when updating the ctime and mtime after a change. This has the benefit of allowing filesystems to optimize away a lot metadata updates, down to around 1 per jiffy, even when a file is under heavy writes. Unfortunately, this has always been an issue when we're exporting via NFSv3, which relies on timestamps to validate caches. A lot of changes can happen in a jiffy, so timestamps aren't sufficient to help the client decide to invalidate the cache. Even with NFSv4, a lot of exported filesystems don't properly support a change attribute and are subject to the same problems with timestamp granularity. Other applications have similar issues with timestamps (e.g backup applications). If we were to always use fine-grained timestamps, that would improve the situation, but that becomes rather expensive, as the underlying filesystem would have to log a lot more metadata updates. What we need is a way to only use fine-grained timestamps when they are being actively queried. POSIX generally mandates that when the the mtime changes, the ctime must also change. The kernel always stores normalized ctime values, so only the first 30 bits of the tv_nsec field are ever used. Use the 31st bit of the ctime tv_nsec field to indicate that something has queried the inode for the mtime or ctime. When this flag is set, on the next mtime or ctime update, the kernel will fetch a fine-grained timestamp instead of the usual coarse-grained one. Filesytems can opt into this behavior by setting the FS_MGTIME flag in the fstype. Filesystems that don't set this flag will continue to use coarse-grained timestamps. Later patches will convert individual filesystems to use the new infrastructure. Signed-off-by: Jeff Layton --- fs/inode.c | 98 ++++++++++++++++++++++++++++++++++++++---------------- fs/stat.c | 41 +++++++++++++++++++++-- include/linux/fs.h | 45 +++++++++++++++++++++++-- 3 files changed, 151 insertions(+), 33 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index d4ab92233062..369621e7faf5 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1919,6 +1919,21 @@ int inode_update_time(struct inode *inode, struct timespec64 *time, int flags) } EXPORT_SYMBOL(inode_update_time); +/** + * current_coarse_time - Return FS time + * @inode: inode. + * + * Return the current coarse-grained time truncated to the time + * granularity supported by the fs. + */ +static struct timespec64 current_coarse_time(struct inode *inode) +{ + struct timespec64 now; + + ktime_get_coarse_real_ts64(&now); + return timestamp_truncate(now, inode); +} + /** * atime_needs_update - update the access time * @path: the &struct path to update @@ -1952,7 +1967,7 @@ bool atime_needs_update(const struct path *path, struct inode *inode) if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) return false; - now = current_time(inode); + now = current_coarse_time(inode); if (!relatime_need_update(mnt, inode, now)) return false; @@ -1986,7 +2001,7 @@ void touch_atime(const struct path *path) * We may also fail on filesystems that have the ability to make parts * of the fs read only, e.g. subvolumes in Btrfs. */ - now = current_time(inode); + now = current_coarse_time(inode); inode_update_time(inode, &now, S_ATIME); __mnt_drop_write(mnt); skip_update: @@ -2072,6 +2087,56 @@ int file_remove_privs(struct file *file) } EXPORT_SYMBOL(file_remove_privs); +/** + * current_mgtime - Return FS time (possibly fine-grained) + * @inode: inode. + * + * Return the current time truncated to the time granularity supported by + * the fs, as suitable for a ctime/mtime change. If the ctime is flagged + * as having been QUERIED, get a fine-grained timestamp. + */ +static struct timespec64 current_mgtime(struct inode *inode) +{ + struct timespec64 now; + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec; + long nsec = atomic_long_read(pnsec); + + if (nsec & I_CTIME_QUERIED) { + ktime_get_real_ts64(&now); + } else { + struct timespec64 ctime; + + ktime_get_coarse_real_ts64(&now); + + /* + * If we've recently fetched a fine-grained timestamp + * then the coarse-grained one may still be earlier than the + * existing one. Just keep the existing ctime if so. + */ + ctime = inode_get_ctime(inode); + if (timespec64_compare(&ctime, &now) > 0) + now = ctime; + } + + return timestamp_truncate(now, inode); +} + +/** + * current_time - Return timestamp suitable for ctime update + * @inode: inode to eventually be updated + * + * Return the current time, which is usually coarse-grained but may be fine + * grained if the filesystem uses multigrain timestamps and the existing + * ctime was queried since the last update. + */ +struct timespec64 current_time(struct inode *inode) +{ + if (is_mgtime(inode)) + return current_mgtime(inode); + return current_coarse_time(inode); +} +EXPORT_SYMBOL(current_time); + static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) { int sync_it = 0; @@ -2480,37 +2545,12 @@ struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode) } EXPORT_SYMBOL(timestamp_truncate); -/** - * current_time - Return FS time - * @inode: inode. - * - * Return the current time truncated to the time granularity supported by - * the fs. - * - * Note that inode and inode->sb cannot be NULL. - * Otherwise, the function warns and returns time without truncation. - */ -struct timespec64 current_time(struct inode *inode) -{ - struct timespec64 now; - - ktime_get_coarse_real_ts64(&now); - - if (unlikely(!inode->i_sb)) { - WARN(1, "current_time() called with uninitialized super_block in the inode"); - return now; - } - - return timestamp_truncate(now, inode); -} -EXPORT_SYMBOL(current_time); - /** * inode_set_ctime_current - set the ctime to current_time * @inode: inode * - * Set the inode->i_ctime to the current value for the inode. Returns - * the current value that was assigned to i_ctime. + * Set the inode->__i_ctime to the current value for the inode. Returns + * the current value that was assigned to __i_ctime. */ struct timespec64 inode_set_ctime_current(struct inode *inode) { diff --git a/fs/stat.c b/fs/stat.c index 062f311b5386..51effd1c2bc2 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -26,6 +26,37 @@ #include "internal.h" #include "mount.h" +/** + * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED + * @request_mask: STATX_* values requested + * @inode: inode from which to grab the c/mtime + * @stat: where to store the resulting values + * + * Given @inode, grab the ctime and mtime out if it and store the result + * in @stat. When fetching the value, flag it as queried so the next write + * will use a fine-grained timestamp. + */ +void fill_mg_cmtime(u32 request_mask, struct inode *inode, struct kstat *stat) +{ + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec; + + /* If neither time was requested, then don't report them */ + if (!(request_mask & (STATX_CTIME|STATX_MTIME))) { + stat->result_mask &= ~(STATX_CTIME|STATX_MTIME); + return; + } + + stat->mtime = inode->i_mtime; + stat->ctime.tv_sec = inode->__i_ctime.tv_sec; + /* + * Atomically set the QUERIED flag and fetch the new value with + * the flag masked off. + */ + stat->ctime.tv_nsec = atomic_long_fetch_or(I_CTIME_QUERIED, pnsec) & + ~I_CTIME_QUERIED; +} +EXPORT_SYMBOL(fill_mg_cmtime); + /** * generic_fillattr - Fill in the basic attributes from the inode struct * @idmap: idmap of the mount the inode was found from @@ -58,8 +89,14 @@ void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask, stat->rdev = inode->i_rdev; stat->size = i_size_read(inode); stat->atime = inode->i_atime; - stat->mtime = inode->i_mtime; - stat->ctime = inode_get_ctime(inode); + + if (is_mgtime(inode)) { + fill_mg_cmtime(request_mask, inode, stat); + } else { + stat->mtime = inode->i_mtime; + stat->ctime = inode_get_ctime(inode); + } + stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; diff --git a/include/linux/fs.h b/include/linux/fs.h index 42d1434cc427..a0bdbefbf293 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1477,15 +1477,43 @@ static inline bool fsuidgid_has_mapping(struct super_block *sb, struct timespec64 current_time(struct inode *inode); struct timespec64 inode_set_ctime_current(struct inode *inode); +/* + * Multigrain timestamps + * + * Conditionally use fine-grained ctime and mtime timestamps when there + * are users actively observing them via getattr. The primary use-case + * for this is NFS clients that use the ctime to distinguish between + * different states of the file, and that are often fooled by multiple + * operations that occur in the same coarse-grained timer tick. + * + * The kernel always keeps normalized struct timespec64 values in the ctime, + * which means that only the first 30 bits of the value are used. Use the + * 31st bit of the ctime's tv_nsec field as a flag to indicate that the value + * has been queried since it was last updated. + */ +#define I_CTIME_QUERIED (1L<<30) + /** * inode_get_ctime - fetch the current ctime from the inode * @inode: inode from which to fetch ctime * - * Grab the current ctime from the inode and return it. + * Grab the current ctime tv_nsec field from the inode, mask off the + * I_CTIME_QUERIED flag and return it. This is mostly intended for use by + * internal consumers of the ctime that aren't concerned with ensuring a + * fine-grained update on the next change (e.g. when preparing to store + * the value in the backing store for later retrieval). + * + * This is safe to call regardless of whether the underlying filesystem + * is using multigrain timestamps. */ static inline struct timespec64 inode_get_ctime(const struct inode *inode) { - return inode->__i_ctime; + struct timespec64 ctime; + + ctime.tv_sec = inode->__i_ctime.tv_sec; + ctime.tv_nsec = inode->__i_ctime.tv_nsec & ~I_CTIME_QUERIED; + + return ctime; } /** @@ -2261,6 +2289,7 @@ struct file_system_type { #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */ #define FS_ALLOW_IDMAP 32 /* FS has been updated to handle vfs idmappings. */ +#define FS_MGTIME 64 /* FS uses multigrain timestamps */ #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ int (*init_fs_context)(struct fs_context *); const struct fs_parameter_spec *parameters; @@ -2284,6 +2313,17 @@ struct file_system_type { #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) +/** + * is_mgtime: is this inode using multigrain timestamps + * @inode: inode to test for multigrain timestamps + * + * Return true if the inode uses multigrain timestamps, false otherwise. + */ +static inline bool is_mgtime(const struct inode *inode) +{ + return inode->i_sb->s_type->fs_flags & FS_MGTIME; +} + extern struct dentry *mount_bdev(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, int (*fill_super)(struct super_block *, void *, int)); @@ -2919,6 +2959,7 @@ extern void page_put_link(void *); extern int page_symlink(struct inode *inode, const char *symname, int len); extern const struct inode_operations page_symlink_inode_operations; extern void kfree_link(void *); +void fill_mg_cmtime(u32 request_mask, struct inode *inode, struct kstat *stat); void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *); void generic_fill_statx_attr(struct inode *inode, struct kstat *stat); extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int); From patchwork Thu Jul 13 23:00:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312718 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 63486C04E69 for ; Thu, 13 Jul 2023 23:01:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E87EE6B007E; Thu, 13 Jul 2023 19:01:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5F846B0080; Thu, 13 Jul 2023 19:01:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D002C6B0081; Thu, 13 Jul 2023 19:01:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C17576B007E for ; Thu, 13 Jul 2023 19:01:31 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 857A9B06A7 for ; Thu, 13 Jul 2023 23:01:31 +0000 (UTC) X-FDA: 81008111982.21.D62B473 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id A29D340005 for ; Thu, 13 Jul 2023 23:01:29 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=liyRtyj0; spf=pass (imf11.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689289289; 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=0DDHRiPYhr0sd9J4288j38yiPCPs8WpS9B9X3tWRhbs=; b=kDaBUSgk3jMtRMl4DppwlYFZVcYFOG5MRkPpXO1l++K/sL+uzIg5lPpA6YlEzGrU7zlI1B 9zM/RSJZu69rnGfxmLdsVgZqprXEaGZ/5I0PkRfD2ZsHOPfTe6KG+cJ7buB5Aw1yzjm/Su AYLC2/u2Fob44ybPvWFgSSJJ0wP6AEg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=liyRtyj0; spf=pass (imf11.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689289289; a=rsa-sha256; cv=none; b=qXrjHHuLYQb9viCZN3HJPdqOWnozFGjYYpGvlku3JB98naO6Xig/bq7ttNBhIl/vdg8kH/ hwWaMQa4OJLzNS9WhFXvNzXQ9vJvRLFbgeo7xv+ZIOUyGRjjTVjFonqoB61SfWWfziL5dM wdjEos9RNKkVyKJn2xOTnlLrDYITdWI= 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 B3CDD61B23; Thu, 13 Jul 2023 23:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 285D7C433B7; Thu, 13 Jul 2023 23:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289288; bh=2uDpIMGQVMt/gC4T/BxJPAgKQID6PeU0gqKfksNKWnI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=liyRtyj08RhKgd05d/GbjIK8eAKSM10LdUJBz7UuFOcUyezObweCSPR4L5Jm7d/3+ J9oIvEYe6CWGwt55Hx9zbqLwPbb7BBKC8OMsAe7qX+kkwyjZAQBfJ+ADRMrXxSSmW8 Xzwhwg78up7SO0XMuFLZ6g+/2Pu108+rBwN7yk/z/7oyzpziWvzwOA3XIxMpCer4y9 lDdui9+QJ0qeG2V6Gtk4RHRd2VjBrRFJoqgHMQsHg6pmArcdKXD18EFN0CSdElLHCP iu0JCzqZtl2wBu87Ybj2JDoeOy/UseVuaxAORwjKb983nHW0GT8ewtb0Icu2w+Gl8j yMGVOCivsa/7g== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:52 -0400 Subject: [PATCH v5 3/8] tmpfs: bump the mtime/ctime/iversion when page becomes writeable MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-3-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=1641; i=jlayton@kernel.org; h=from:subject:message-id; bh=2uDpIMGQVMt/gC4T/BxJPAgKQID6PeU0gqKfksNKWnI=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIusbBzLs0MybgDecBYC1rFLHPwWpvQ+zecR awgGePAm6qJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC FcSGEACub8Fc5S/WfyUSGxfmCSi3555ycDn+zVKXSPPiQKW1TR9LYRkybKANZmP0XYzYILSUfkU ORbNjYimhQNCSxlPeeC40MyHzjga0VRHqurUT8qqaVIVJ0nl+StBd40KLXAljpP3WXM1fGUAjvH vqO6pP6I3K3R/4qwCRMhWrNAcqt+qYKWVUUztTablCUbuklzQoblG24U2NK2DUfGepPumyDoeLH wYod7Y1kJ92qyEoEOPNjj1+tfqjWvN7+tAsFQwpD+N0sljCCXcg2XWKOgVJBsYaXx5OEbRfi6s3 ryBXi9Xk0/jA6otq2rUp6HaQyJkl6teNxs+4rz75eCu8rN02oQaqFzL83u3vBt3uPmVA1pHdS8E cYZhQx3P7nvLTFlUjA0Rbi4sH0FtHNJd3k1Gzcl8UkDcxVz29S7geHX+Nfj1BSUqKI8uA6NsJuI nzON+pBrEdS0RRFHXzAKsdPlG285eEeNPzqWMmCPQ8I0XVLSP4vbJ+WFJhx6uO+c2gz3VEz5rKg 46OipSdHjwUcz6Ps1TPvZpf/Z2bvpL5yiA+tPHgQX1nrRyMepOjxjN4vJX/dTEcENn7ySGN2vWY /RoI7eVxl9z18K25MgUs7+5WZGKkUPepl/96nVkOPQyWbt7euX8Tx6c+OgzD7T9pvDRi9idRO+a oNvcYRCw+z4sY9A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: A29D340005 X-Rspam-User: X-Stat-Signature: 7cwszx1cjaqq7xqmfqi381samhu3aaj5 X-Rspamd-Server: rspam01 X-HE-Tag: 1689289289-73476 X-HE-Meta: U2FsdGVkX1/xPD9pIGXaghXQRRJ5FF+5CG8TPUGtlfwXzP24sFvGKAzL+PRY2ZhOnb3lpv8b3hbukgL3lKhXrv8U4hU/7Uk4Nb9fyP4rl81RESfiBuw76wHKrXcjKV9lGylLfuKoloiWGKB9jk6FJ5nPBw5aqsRlmPEl3UwGwse7iBO9E9fQAZSScag8XtPScOFFkoaxOb4Tb3sNvVsrEB7GmvuyE0rG57YYpDHvTta3jWO7+XtFxIWMlKejM36fly6zIN6Z5/RHbjjsIRRzxCIm/ys/65FCDplwjfdmWiNFdktV2i9VWtjJ54xoubwKHPxHIntS2f+qU7Hu6CF13HeMdyKeVymmL8pe0mMYbwulCEtTY2Jm3oxtBSMjoPCk1JbZUnwaOUVIUwY3lFlil/mPB1kDyGlc5hbbYl1YB6y/fCwHqC+ctHYz3TkFe2xwslrF71SQ85kCAM+5QhEuK8QPJHu0ctTrOkdnXdjrLhoy/k56k2vkgcPz14yeAtDnQjWVKELT3vge0FLCmHm5zY+NIL9Y/QA8FAPPAbASMM81KjaxcRfMKT8iYvH1DOngSj0wNzQ5IL7YiHtZLGbmv5rj06XkoezQ1gLmkep29x0sEKhrEKJx3/buKFh+h0jf27YpsdHlqrUl1OopmRgWt66O1EZIBjGyDNxVeVF0esqtWESI/XOKly5k8ksuBWCR+VBAvLISzb7p8O8XXqO1ms7ZSdl/oaAw+LRVIAssHwI+77YId50LgrG8z0eWKo3iVQ/k6smKTc5a4YA3TCNHFsdWAj+Ll+BcrgX1dh8d+MQ7ZnX4k0R23SK/DHCNGpRhk1sdFdzc0EsMViHSpbzVKId1hQdb4EGUXvS056Y4T2Mz09/QgfTL2G5j9RCoPG6gyC6gQBgDe9FnzjBY42qIjMSEqnkVmLVRZdJEdTGNpVnp1w91SlNIma1zfracNwo0N/jJ6lpJo2nxecS50dK k4hStTUA Q8ic4hLBQBj9HepD4BwUn9Xex6ihfNmZSBhC6IOaOQlawCNy2PlmOZh4CKKyGdILhlA1QihmlF9t3zYVZoYlEWmRhllEbPCAtcaZZ78cWHq4nYjBP4spJSq7DBZQTJTp+TBYZ1X/5MluGDjJV1F7ukR0OS20opGvFHjQI+0ag2Oue75ltzRu16EFgLmNiX1vig20vkteE1bHqY2Gz7h1i0pp4RXrQVx8LOAKV92CxDnV3womyMa74vmDBulNBfFCaTDI0rdTD1H/9ZlT1tIPsY9qcaX+CDP/iQO1omBd5GntyPm9ntmckoCJ9UrwdJxMIXdZrCbuDxnRRC6gIN+5nYKJBLqyv2xzYevTx 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: Most filesystems that use the pagecache will update the mtime, ctime, and change attribute when a page becomes writeable. Add a page_mkwrite operation for tmpfs and just use it to bump the mtime, ctime and change attribute. This fixes xfstest generic/080 on tmpfs. Signed-off-by: Jeff Layton --- mm/shmem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index b154af49d2df..654d9a585820 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2169,6 +2169,16 @@ static vm_fault_t shmem_fault(struct vm_fault *vmf) return ret; } +static vm_fault_t shmem_page_mkwrite(struct vm_fault *vmf) +{ + struct vm_area_struct *vma = vmf->vma; + struct inode *inode = file_inode(vma->vm_file); + + file_update_time(vma->vm_file); + inode_inc_iversion(inode); + return 0; +} + unsigned long shmem_get_unmapped_area(struct file *file, unsigned long uaddr, unsigned long len, unsigned long pgoff, unsigned long flags) @@ -4210,6 +4220,7 @@ static const struct super_operations shmem_ops = { static const struct vm_operations_struct shmem_vm_ops = { .fault = shmem_fault, + .page_mkwrite = shmem_page_mkwrite, .map_pages = filemap_map_pages, #ifdef CONFIG_NUMA .set_policy = shmem_set_policy, @@ -4219,6 +4230,7 @@ static const struct vm_operations_struct shmem_vm_ops = { static const struct vm_operations_struct shmem_anon_vm_ops = { .fault = shmem_fault, + .page_mkwrite = shmem_page_mkwrite, .map_pages = filemap_map_pages, #ifdef CONFIG_NUMA .set_policy = shmem_set_policy, From patchwork Thu Jul 13 23:00:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312719 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 983BCC04FDF for ; Thu, 13 Jul 2023 23:01:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 141DE6B0080; Thu, 13 Jul 2023 19:01:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1192F6B0081; Thu, 13 Jul 2023 19:01:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFBA68D0002; Thu, 13 Jul 2023 19:01:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E3A546B0080 for ; Thu, 13 Jul 2023 19:01:37 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AC7CB1403E4 for ; Thu, 13 Jul 2023 23:01:37 +0000 (UTC) X-FDA: 81008112234.23.3AB52FA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id BBCB5C0007 for ; Thu, 13 Jul 2023 23:01:35 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hh00jwFL; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.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=1689289295; 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=6nWojr0hKqa4JaCj2j3XdG2IwZm8djxTYWn9rXHaZSQ=; b=oItmYt0bkiVMwqrq1k8aJyBWBDOM6RUmlIUa5BZzCAt56OsymyqAyPIIAhH1kJaELYgPh+ wp+gUyf8kw+Mhs1PSZSqkT1LPS0qXcVUHHJcw7oOZK7SJHEdDGR5jIQ4Y2Wl/jmUuv0ooW /Dp8Uo9yfc7NzAIh752VE9FtHpmbspc= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hh00jwFL; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.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=1689289295; a=rsa-sha256; cv=none; b=YgikdvYphzBQSjgu44QukKZ9Pc/s1s2mFS2E7iUFpv6b/Q1NhwD+yUy+swQR2v+9sYam5l Ldg2gFhjHRy/KZU+SlPupGq4DCh06jw2Y/hxqZqHZ4w0LDs9nEvbYwqtQxfhUsdycYT9qY oIxrVLWAe+4EP+t8R1M4EHaDZjRyLiA= 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 00B2F61BBC; Thu, 13 Jul 2023 23:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AF0AC433AB; Thu, 13 Jul 2023 23:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289294; bh=1/8G5JaqUI6KuuI2rdJCgZt0gS2ge3CDkWe83TSi7uM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hh00jwFLXVTfcKcYi6RPk6teBq7zejtWeTElcr3hLDz8IAh3S2IemMNuHXvNi3H4F QeScQzWiLdKG7tjJSKUXq0nR4EDtj340vqrwNrAGN9Ia5Apqw1huo7Ebzqqr+YuBHl S8vH6aKqZUS7hfoeQEutNX1WiQBlgdv6b6HX5VFk8w3yzBCsNmYk/OuKkH4+kmf6Xs IYNGYH5akbWDjFEM9PyjTvjKeVnl1B1Cl+gOPyof1qwofcutPAzvLpM0Zt3wUBMvdk wMl3V4hvpXSC8ipgZ4JRx+E2h8IU4wBaWS/eUE+Wwxz7Pdirtue9IXVzOudQEM4w2F cFAbu66hjm5kA== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:53 -0400 Subject: [PATCH v5 4/8] tmpfs: add support for multigrain timestamps MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-4-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=769; i=jlayton@kernel.org; h=from:subject:message-id; bh=1/8G5JaqUI6KuuI2rdJCgZt0gS2ge3CDkWe83TSi7uM=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIu7118tb5CNCK7sZ1VFW0yB4BVg1dD3GIAv 39qas2sg2GJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC FUn6D/49/foLE14L6mU0xG1UWjybA4xy86vpS7roooMdiLD221RNkxIE52QBUyp5CX2APfX200C xgbwOJEpcptUud3PcBPoF8COlI/ERe5e9OpVHtCre8aWzg7pBf8pyMnE+xoIlAU6CcTJFa9NChV Olh6k+5lVwTnIXRD08nJ08naXSWCIsW8EAkrCywfB0ucIPaAdk5yfs6ZWKvzIJMOzvf08q/tyH9 IPHUxUX0sNKpgXmXfCVLjFp1wKn7r8FJxarJeURYrLr5rWYLdmmuZ3E/WSTwdKR9okSva8BrC+8 tkEb9EnYwIQbXojiol0Tl6DrLrvHnxRVaDPNi3FrTXczN8j1sYa8/j8LsuuDJUAGBKU/GsZoV6Z k8IiUfrDxYkoLOcyjqRFCQVEVVuF/LdfPx20g0wWhX76uRq9NHs1ExBBUfZaYnRhSrGmyGs9DU0 XElBc5CesLSUUltqLb6O8VK6s1T89MT30rnP5PaV+5o2tpoJN2Dh5OP3DRv6N0IaV51inxOzm+1 bQZO0+M4M9zfgjIsLAEUgrLh1kmvhU8dp1bTqcY+n6Xy39Cw4o2bXh+v+RGZBC/3Kum9DwFRvus MJ1kz5NoZfCBO7DrdUL+sgTN6tbKn57fiTUf2f+6Sk0T5YVQSiZB21hj7z5csvZrdxGKTu7jyCs h/2N1SUvw9AsY0w== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: BBCB5C0007 X-Stat-Signature: tgozbthnrrpjcyny1r699chaqqxa5saa X-Rspam-User: X-HE-Tag: 1689289295-889842 X-HE-Meta: U2FsdGVkX185c1tN1XqSHEoBrdnlvjjdKwtx57Gap5V+HIQ7qfiQ0Wld6dfpYbL7pDD1263K9h+5UyzOZBbtShWcE94fKct1zPBtNTek1WiEl4JHk/19SD0YG4qJfK2vjIwgwin187Alib7QuXpYppYg6pgdACCMWhWCj1UaebPaiVx3AFMcJsBL/cwUF/uRluWb3To8ONF7FE0h9+tde9/MV6c+z6xuytv3ADVO1UZ3Jd4DcnjosxAC9tW1zRFbajNvrb7UqgWgBPH8oX+Zo4WXLhFyzq1vXfs5cSycmZfxcxvZoKweAEaYN/dHXEiROvpKtOWKyDKbQn67orN1kWqaTTEWR9UO5EjRiZA9M954hjBHa9Cy2+NvD6UwP9wVD9NYNADizooHWclqUkHe/aJhD3yKbzxGkQB4njBp3pBzPZs0ZJ3Yh2AJlpINarIBIELHMN2Ck6x+cEs0WR89PXDRRNtqFImV7C3V0QCZJxfhUtMI3/dFF+pwkEHy55inFqpn6RY+Bm9jn8Au2MID1DfUX2cvDisLXd1TCUicqHo3DzlSZnxsY9LFzlllY02nJrdrTkuj8n810bbU8Zk4EkuHBOE892qxcuOd4N3kMeiYgUmtjnSbKEMpIviu12onFNkbqgqgprBh2y78Gk5QX0tQIu2bQhJOYItUI4gjIWMUwzvFwMWviQem5/bUzsBAYVPdjMnjXDTIj5doaLD+tk7V1rJT0RR+Mtbgua4zgkFNF+pHxcR5zL+XQc6e3flaWc07SDWBxm+IaJn8h1jo3l7/KaBZDXg8WYp6IdKwX6Ydkyzf+BPNSRKtVaT2TNWp23psUIHZmYZ5xsaTYx+k9ErP5Zx+lyoepkRrJ/chlxm/da2n6RMoP6z7Vx5fq+Bea5EWgjTyq+tDcqRc9i1GC/tqlgBZiqJt5ooUPsekmRsOtSjmNHajlSKMZnp6tSmC8liTIHjp9gNVQDxSuA0 RvKJusKl cBOewDOHMTwCqziPinevtXmJKhxri+dCd7Ev8vBr5BrxXpNhlaSgDdn2VD8NiEIotmf6BtuFDYjOmS/0vuxLswIM2opyCFEnEHwxyE/sfcER6+CIU2dyoo6+sLW6XwlF0RPsnF0L9DTxaHEAFCPV2FT7n1JsDLAHMW9DwdI92lVcKutfDkRcwvo/Bc7BB4qD0tiWNd6YFwz6Z5O/wRpPUPP26VzfTfbjigqi2WZzWtD4Ow6K8GIJt1dF9EL2AQIfJA5pegtGxqEG+57ioS/OcO3ia+xGobZDhZbhgpKUmkDo26m7IA3XB+OudSML7eRwQvsY81zB31eL90qz5MRBa0P14hcbu6TVzsbK6 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: 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. tmpfs only requires the FS_MGTIME flag. Signed-off-by: Jeff Layton --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 654d9a585820..b6019c905058 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4264,7 +4264,7 @@ static struct file_system_type shmem_fs_type = { #endif .kill_sb = kill_litter_super, #ifdef CONFIG_SHMEM - .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP, + .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP | FS_MGTIME, #else .fs_flags = FS_USERNS_MOUNT, #endif From patchwork Thu Jul 13 23:00:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312720 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 9FCFBC001DE for ; Thu, 13 Jul 2023 23:01:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B2786B0081; Thu, 13 Jul 2023 19:01:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 362BC6B0082; Thu, 13 Jul 2023 19:01:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B5408D0002; Thu, 13 Jul 2023 19:01:44 -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 0AC156B0081 for ; Thu, 13 Jul 2023 19:01:44 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D66C0803AC for ; Thu, 13 Jul 2023 23:01:43 +0000 (UTC) X-FDA: 81008112486.12.AA8CA5F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id ECF2440037 for ; Thu, 13 Jul 2023 23:01:41 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BikyFRuC; spf=pass (imf17.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689289302; 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=xvtDyXZiv47HaH52LmRi9yHPxJlG9e6XVtw2iD8b/FA=; b=7ZmvN15O2SBfucFhpQlq1+79R5XNAfBST2rjVS3DJ4QbWUO5rEIQ4eEjk0E+QS9lrsr8p9 eyv94DSxqKzb7Ld+fSL7wZHjEuryAsuwMOjyw4YcAihB8nySB5BgzeiDeJm5cMWTt2kbwT akgkodbePJoB1WY5s/EkaiDuew8Y5m4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689289302; a=rsa-sha256; cv=none; b=EkXP4/9ZKNL6oFqv8G+w1tiDyPKgYxh8J4e8uc7dtOpts0gQrQns7GiyK50EP6hVjX65zD JwFU3XIBpNmMKEnQm+1dnkqDYOw7wsv/F5H11iaO2EuIl3nqPOrhcCMaT7YUGQ7rw7yLOJ 2PIw+UlkEtE1J9a7tZbLEhUCwdfDBy0= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BikyFRuC; spf=pass (imf17.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org 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 1F3BF61BA6; Thu, 13 Jul 2023 23:01:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D1B3C611A0; Thu, 13 Jul 2023 23:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289300; bh=aa5qbguHFcu6OOlBUAepw2+xHt44QiNWyfL22OUBSqs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BikyFRuCdOODbIqFMPk9kNKNlEo0dYJ6zt4FyqFTbTjpdmiUktdW71dJkcCNhfnr6 IH8wNPwLcwjFwqbPM9ABFfIZZoaAAjZWuXcaDgVP/9O9ow8exs0ur2EO1mxw06CUVs OIVi6P2uBcHxFX31zL/bkUGRt7Vk6GxZq50OE6iR5Xkgc+XbbqUbUANDiMMWaLTCgU 9YSpAieiO+VbSduJMVGrLCDzqj6M76cg/ERleiQQWLvjl1lRNaDYvlOMtASHc3hRxY 3zxwROtQCWYj4ZhKhLitrJ1WKe8G5IuDdn4pkmXKWnP8iuqxCuy46i0Jj0SbW9jVX2 AHP5DZp2LCIgA== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:54 -0400 Subject: [PATCH v5 5/8] xfs: XFS_ICHGTIME_CREATE is unused MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-5-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=1284; i=jlayton@kernel.org; h=from:subject:message-id; bh=aa5qbguHFcu6OOlBUAepw2+xHt44QiNWyfL22OUBSqs=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIuYLDaeyv+0bFKxMDi4TCGl7qNqh97QkbqR 7MnTf0XpqqJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC FdKeD/90gpS8fulOOgQezr1N2uNArvD5brmGxA6b7tTzZSvcpOejwinrQKvQhs+PxBZDriYQCQh OwxNuTnA93R76ZkHT+sLOHGoGBQ6UBAtkzGtxH9v1fgcuhwappw6969ZTeRpLIIWBZ0MFdVDXTe YFcM04RAjErJxaPi7Kt5ULpq1V7YIjHa0dovLbQ7frkm24o+WlVOqKpXRct7ZQqa2k6bkGFkhed NZPwy8zsD4D/ZthBftUASAETJsO1x4cs1v02gmv4U6YR4J39mE20H8TT+918pwwZU/VSIOj1M8H Oirc7oG/xtEnVFeE6nGc9DoXtvpO3IUf1FdW5mKKcKqLzZoKXfj3gk1gLXOX0mdQ2JHPZcGc49+ LHI8cuBfrkN/yVk5aVMC/t0fyaM1xcR+wuz2sQL3b3ax5gG8hx3oSg5INanDl7BDUq7lbtQYpHC 44+w5XUDYxIFpjAozvDGpAzbAsZNp/fmKeaNAFZ0DPSY2csmopw1l3HzeL2s29LE29J+DbWrN4Q dQtkbmyLS83Mo3Rus7OEOTowcfLEdmVZ4nlYwkUBpsAbUeo3Gpzvy+DYU8t8ma/Kb96NS7sEx81 5WULDzoq4LwO4MreHRa/DvZr0oyyhT5qcmZWNWLeSdaA0x6eEh2hzaWN9VBX+UNVXANgJRn57fJ LrcnCGwsCj+PM0g== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Stat-Signature: h3o8usksigb8yf5rmwrjskm9o35g8ixx X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: ECF2440037 X-Rspam-User: X-HE-Tag: 1689289301-954258 X-HE-Meta: U2FsdGVkX1+bASsC/Hn+Oo+Yw/z2ssf4MbmFZe5VInbmBXqc3whtTL/IC0XwYD5sQazBP5riT4FkY0BmLP4IsLTkhFRr6E4N8Y3WmRcEKWpHETtkV3OxlQewUl95bXfxoKG9MrlpJm0VOiUGqBueCOK0fnjjySPKqZxL6XPEG/IrSAfPeaEmCdhwdBWsrWjPn8VKlR92wVmshdeGz9ReFUF8zjNmz5b+4AyUGP174HVt6RPVAiZqt7RD6viFUwkKGad34Ht8UJorBRXtzwWHpU6KLmiwZQvkczIsttcw5TewBKU9SGD8HwhXj3jMGHfrXUaSAuYj/0La3otzhuy9hLI3FzGSdk23aTasrJO1AZurVggQWfSn8M2g75EN9BTJrPXgsXI+72z57TG8JOVOyieLrZgL/1jZbkUMnRm1TmDDc8iwOJ24PprYYhsu2roFyGy5ZQgdk48ndrz08xIXRwefZdI/vKBdgTrmdRpVmop4hCQNARh4wL02TZoa4VdeyCIdzUFUaDMB/lQp+9OXSXENoBwFNfVDfdCeYw66vEp0XefQ4VZycsaVg0vdOy+IAfyFTcFWzUtsKE/KQO0RbliFrDFZvF6eKAtXetLhQqb7fbyDIfYp8P0xpI0KcIYuGXVswpY+uoEMY8F1W2puKYc7vImYOmBONF1/M0Z9fNKOOVViQNIMWDWeeR8PbWflGnqOywhc0bWhooQ5r+h5Z/EXWm++X4hWVE97beIffOPYe8nuiXrrAwKgN+NNGAfTU7CUNxYNOIXNPbD5SuT7b8EMFAqdwbEJrX84KlMsiSaNZEuirAtjxPpwcpEU8UR5RT34pK3JPm6euHEtowo14j+RqX7PNZ/PgBFA0/X5KgfEWArHOZqMMzsmRlJe+sZVf0v5D8uXDT0AGI5aJ2C2DYgTQVni6Ep7OhgY/UjoQzyAsybwCX8Kh2LGkHFu0CDvuenxhhWh5uyPfHa2ldU xv13TiyU y5pQ/T7Ds44BKH+SDXLNN0k8RT2hVh6g6++W2Ype9JsHxSomz3oo7rn4Jsz5mjZN/Nsydlx4s+Wsj0DAlCc2Y4iJv0h41Lj2bNL0qzZtjfphFPnh1Du9Wt0m7sHPWs1TI9+c+iN2DfreCH4G5yws1bzb5UdjqupKUwA0aaaj0xH1nmxKdaeDaHj08l9fVSIVThDExakgfs2H6zgdoJ3AeNCLPFhkvhTQ96c88RQliRYpInxkFtNbZQVZ7RVSHfNsyPNP9zJ6NOggQ8TFRQmaZkXT2SQztY8nEE5e+6629V1pBvIuTsRn6P2ZjDg7g6fBynh9LW276bLbnz7dvLZf+UMSLRNvcikdVFDfELV5UeCDMYuR4kifjAQBgRfoRfoskXBrN3v9oNuo98WY= 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: Nothing ever sets this flag, which makes sense since the create time is set at inode instantiation and is never changed. Remove it and the handling of it in xfs_trans_ichgtime. Signed-off-by: Jeff Layton --- fs/xfs/libxfs/xfs_shared.h | 2 -- fs/xfs/libxfs/xfs_trans_inode.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h index c4381388c0c1..8989fff21723 100644 --- a/fs/xfs/libxfs/xfs_shared.h +++ b/fs/xfs/libxfs/xfs_shared.h @@ -126,8 +126,6 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp, */ #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ #define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */ -#define XFS_ICHGTIME_CREATE 0x4 /* inode create timestamp */ - /* * Symlink decoding/encoding functions diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c index 6b2296ff248a..0c9df8df6d4a 100644 --- a/fs/xfs/libxfs/xfs_trans_inode.c +++ b/fs/xfs/libxfs/xfs_trans_inode.c @@ -68,8 +68,6 @@ xfs_trans_ichgtime( 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; } /* From patchwork Thu Jul 13 23:00:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312721 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 39CA1C001B0 for ; Thu, 13 Jul 2023 23:01:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C16A16B0085; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC7006B0087; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8F108D0002; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9ABCD6B0085 for ; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2874EA03D7 for ; Thu, 13 Jul 2023 23:01:50 +0000 (UTC) X-FDA: 81008112780.14.3BF1F45 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 1ED6D80004 for ; Thu, 13 Jul 2023 23:01:47 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Dmuulj7M; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.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=1689289308; 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=Hh/yJgVFsNjzYD+FWMHoMPHZWh1GNNWQMircY/bzoxI=; b=kxIVZn5Z4OzieMVmrOcl3c8dd4iCeY2mc16QFsQYBT+MHDYp6DhVj9nqVkrGGCl8uilQx5 4IWBK26kKcgptQBAdArtVWWt7y0fVnk43wIgPgNK3zNoWoeMBTySNlRQXDjTNUuQw8ExXt WeERSO5K+lI0jOC709cYtb4/Z5CLjcs= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Dmuulj7M; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.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=1689289308; a=rsa-sha256; cv=none; b=OYZN9zdxOTF+hZ4oBxHZPINwxTFtR7NKmBDjs+dHm0guO4KUkHXsOarZFHc4S9yD7PCxLx m9KsE15Y2Q25OiBW6ofnb2wd+VpOGwa9HYcKwrDeIopHoEWdszvLVvE+rJUEHksxLe7jDB nKmJiv3a/8AF5it/1Fl1TpKfEt+VNr8= 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 519AA61BB0; Thu, 13 Jul 2023 23:01:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC92CC433C7; Thu, 13 Jul 2023 23:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289306; bh=o469Gn6TRoUgWK1yzrc9Tq+Zw/B6gpe2ALD+iBBNLtc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Dmuulj7MQ5xrcZlRvkmqqt0cLhw9gHOygWjyV1GMrQh2qQIas328YpVrvgYa/9YlE jdjzasvIwgr2pzbKhJ6bkYvRUPUJ7Cf222d3QWzBNDDOHRreW6B5jNpd7hZSqUP0DG 1om1BOfqMHiJVAzIrAkBkZ7yM8hkiudMOoj8eyWVmH/DEftijdI9AG0uCRfjjSpArl vRWtCQtjZeUK6XAELF1K+qzyF9p42KVVOnsGhDho4Iisz00CdwAYHBxCcwNy70X3P4 ejK2Xi/B3UJqCd5vzE2APsFaUo7z38B+tdOnS4hwn6rB/d8Dd39Uv5VG/MGE7hJNYJ 1OevplbSpgwNg== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:55 -0400 Subject: [PATCH v5 6/8] xfs: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-6-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=2342; i=jlayton@kernel.org; h=from:subject:message-id; bh=o469Gn6TRoUgWK1yzrc9Tq+Zw/B6gpe2ALD+iBBNLtc=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIusPIfg6vbYZi6rm+r8gNys41rCFzK3/3ia PhemQOJxaiJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC FThOEACcN1l8TjhunRlKxfjl4GEZ1QeEwjtNX4gydoy2OgNjHxlnhXUZMCY77aPaf+2xc/lyobv SSRfjCTqzzl07bwmqkVIo3y7Dxq50Z45QXZK6iuErpWLxQrjjTiVuEtnmMRRLuu+5ZC8MNq74xP cQDdCkZZMe73bLkpfyCPFksXYk2bv+JK0B+CzboQyXxWRMjctEtcDAPG4JYms7znxF1dSXoVylL /J0KhIQ/r2ezXNSqhAMPT2r6o68iDUtaiUytMhVuc0W6TjfSeBLNDmKDnkzC3PKN996ImbU3ZIf b9SMQeCUPEp075x9xcKTdGaEUG1n5P9oJfoFKiV24GIHsQGpFrwdSqL0TygTRvcayvSudZTAzW4 p72Ki0HJ0dZv94qlRvtNf2K69SVBBzryWi3A60MH2db12+d0IpOYFAd8U2R+0L4Oq+yUbcbSfmz W2m+cpeKx0IHdjswC4j0Z6FLkR10k+EDV8ekrW4hkiCtShHlCKR7NqQOevac0gCVYlpGY1SzZlz n2AzdLF7/bZeZMuQyjmso7Fa44qUoVkL89Xa9HEUbpMj8IYhxNGK7hy2jUfl2k45+Xtew7aOMFn jJQ+eCf7d2aslrHcY+jo6SqVZa88+8H4i8F5gVH9xF5kxLuy0AfSoJZuN7Q63Rb0/Rmi66tBkCi H+1guzkn1J2LjCw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 1ED6D80004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 91u1k1868i9j1et6hrmrj8i8713szz4o X-HE-Tag: 1689289307-978562 X-HE-Meta: U2FsdGVkX1+KVBOGNfyBCjJtSmrM+IphDy+X/5+jNRor2DBChSH8/CJV//y0sJz7hWhBy3EWIZeHm8oAcHMWeujWMr/YHe4/2/GdTEwLI2K+EOugN2op1yeSM7lSv13/qV1kFUIESOKi/zE9A39B55KHFfcngcjn9vH+UoF98CBZq8XhJqets+4Wg3DRyS/EPDRQ1pN8KsaLeHP0gZN8Ox2yM/OltS5SiEEnOLTckhZ8/HBuZXKOE7jimOqsidxSR35m/JlTSjqAa2eiJNHftYWldYhbOJeGmfmgiHBwM/gIscJJ4KDHpKfZfnGJRuoDG/9Zrup8ah2l6zQInEcy+dVAVGdx5sBbYxN86bJ9e2Yr+aP3udGhju0DUvlFXfP8HQAw7Onpc5rimGbhGk1vflQmM1lMmwohF+ILm2XlRBVj3X4pv9S3nH9JfD+pWPQl8mGc0WXdat0+WtLHrSNbpQLegd9Wto7qAwO1BFxOaIUjO8Z7L7D0uO6+CnKWZi9yn9CbqAv2+EDCKsurUCK4xS4JU79CgJo1gfEWlcC5hBXAeQr4gHDBzTo8wih5OGHaPExHPmBV6pti0d2FOpv+JrvP3jh4tmJgJQ365ddmTExUrHKoeQfGS4pOZZdyi3ExDJBufeoEKtZ9ohfEeeRy9xVcuEWa5REct0uMjO1wyYe8Wv0sXwb2EsD361fZvaT5RgyLlhwlmlO5PkJ73AX9oomd1NWTXYYmBEl+7EV08oVhOssz0LH9l6zh27HD9IYkX/OKKebGHQ4Siq8KmPdCZ8jymIb1ldXP2vDWQR/b5JbaJmh7TLlcvsc73tFpx/3xMxMAUKAb/M1dCyqnxCD98TQodz1lqS1r5UDCopseCDGrNvmQ9NSKYiiFtmzqP+tXgzbcxqtkRsk6V947C7eV5tbVi3ZY0RZaU04lziIDi5LSk+WhJo7O0+urYtK5nrZTYHL5vw/qXrUNn5rI/Zt s2gH0IW0 f8oc75qOtdN0eMgklmE1fAV2x9N3BHLxWsZyIQO/sQ2Xh4M0vo7TFBf+Nip32CZ4CzB2/AnRjPFHEubEqyPdZo6sqebF+AcfpycpzPRDdZzfCKSiXU3W1GWVubaFf9vHnqUJEqTO+TjhPoCKfpPLFG5kXWOsid/56HphCGtj/w0nkJ8hACBym1yUyLrC1eBOJCLxspOdj61zeUxW+S/SLHjxmZtOpdmYfA6l9KYRvdWqdgBdpNCEUTncEU8uxMvJLK3W2y1Gqab5ofV40hIR3sOWI1gRwZgQMGc8rUnsArnTDzjiD1AEcBxkAfk6lwtGulZDd/petbRVS3nsaswIGVvCLDx7v2b61rGcJ 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: 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 warn if XFS_ICHGTIME_CHG is ever not 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 0c9df8df6d4a..86f5ffce2d89 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 */ + WARN_ON_ONCE(!(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); } /* 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"); From patchwork Thu Jul 13 23:00:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312722 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 1D45BC001DF for ; Thu, 13 Jul 2023 23:01:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D1616B0087; Thu, 13 Jul 2023 19:01:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 781286B0088; Thu, 13 Jul 2023 19:01:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 648B16B0089; Thu, 13 Jul 2023 19:01:56 -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 556F76B0087 for ; Thu, 13 Jul 2023 19:01:56 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 339C7B067A for ; Thu, 13 Jul 2023 23:01:56 +0000 (UTC) X-FDA: 81008113032.09.8959965 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 640FE2001A for ; Thu, 13 Jul 2023 23:01:54 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ji6lTm8i; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.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=1689289314; 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=X0oljiepnSz5gM+zvheytrmp9iA1L6amij6hJTcG588=; b=DfjBjxffL2umD3at7zIZSCMf8pPY63MV5yfqFGWTHW6XpsAg4Rk3QnzwiUigWVcQcyZdr4 RfC2fGiekz5eKwUp9/6nVdxCkI3AHF+kBuZYnj6Woz9zxh/1pqDMFyI9nxTfarHKwTWzES DgSXJBoISYRF5iaQnjO+GpspgLcnaqg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ji6lTm8i; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.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=1689289314; a=rsa-sha256; cv=none; b=aZBaCrjWrMmesLSXI7WjbjfawBd3oAxw5IlG/croHqOr3MYhedWbEDLbFmo9ORPlMBSP4d 71ZG3fCHvsrqBiiCggbU9iZ+QSroRgSUYtkkHkO4bW3ifBrbmhOUJa+F6O4eZq+Yu7+R2V TA8w2KHY6V+atrB9OSwCGdhrv73z9IA= 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 80B8861BA9; Thu, 13 Jul 2023 23:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC563C433AB; Thu, 13 Jul 2023 23:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289312; bh=kIvw1OVi/OYz+atwIBCynX0q88XJ1zU1WapHn2pYQP4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ji6lTm8ixvNtDVVdWA3hLyHSMWJKcMADi3bT5BtloRaThTlgVtrnfDXRVZYz43eRu e46QVkCnWld61ntI9tgz1GRsuSCFqBU2ObStlUNmu2ITfHTBwbv7vJEVbd4VhZV50Z dT95XgUQ0gE/E1uvcZKi9FQTchZ0DfPl+ZI9RB22N2f/MLfNFP/JZ9fevITXI82Nnn gxkb+MeSgX88JSRcRtINCznpW+x3Bw6LJRgU7m1nPn5OW1YU0SQ5fO7Mc35+2Am2DI 3RZxGv1qzyqNs6VT+JidZtfoYQynlt0REEMl5HH24pEX9jmVLyVDYYNkSzsIu+nPLz p0XGmDep4V68Q== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:56 -0400 Subject: [PATCH v5 7/8] ext4: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-7-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=843; i=jlayton@kernel.org; h=from:subject:message-id; bh=kIvw1OVi/OYz+atwIBCynX0q88XJ1zU1WapHn2pYQP4=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIvy36LZaWXx77QDXekEjnV6herdriJfAZSF KRvi1GJeviJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLwAKCRAADmhBGVaC FdpuD/4olF8PfkzpOMhKo0pYakgpPOkYsvbjRlnWul1JeLAyEulDwt7cUm7WvWS7sMfn1nmbiyP ZHDXA8DklrSv30kAkd/SL9dBOk9CqQRpnh3gYQN8VNdWNLw39gnLGtNuYCpAfLNo6atBt+fNyyC 9JTlkqthcsWlIIJg04NUID5P3Jx07BORb0Uye5L4hJyaE1uS3bR9dMrxhAWH4RhuGTPnQOnDXy0 8jUhXWSuWv5boD0GGnQiwKp0sMI/s08qlD+VHcAKA3ng2vs9Kgpqr37JvvET803NiGk8yj9pL03 zs0M+o+33FLV8FRVqOh+U+Jx4gU5h0mFwEp9K+Thq8cujHzoq47kEHiEUovgVSQuqftTIVBazJG hs4VXOKAnNx4QoIzUmqCsLgvvJMSxUqe1h6CftfWNBb74Gl7VROa7K/9RRLjvfgLUknDQaYmnWs uRwFrVVPpco6YGgC+fPrV0+xTVyKEA/2zTAlQWrS7tRu0NtjQWSaQcYgz1Gpc6JaotWcgbi9HFc DovY/3/xXCkw7YtqNGLZBg8SMoSWMoDxy7Uwz5OXs5uUpmFp0p1YgTS1GFz/wgOrNTbFHTHc3QX hRQiNndjZv+/zFzfH7J5roV04qDMIMAABTOlktx3N/eKz8JCFhz6AePPqjavoMl+dS8drsBe4xd SUt6/wNve4Dcx+w== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 640FE2001A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: w57axexos8ixj8rs4xdmng4c6d57edo7 X-HE-Tag: 1689289314-504064 X-HE-Meta: U2FsdGVkX1+FzmyBw+Ok7rqdsb79vFVI2dGAU77a/oCowUMLPDKC+hLUOdstWsLoPJuq7naxow1Ad1Ly4eSPGV/RHny0fgtPY9PV4ArFjjECzKVHFYHqbwgDe/Rj+76/E95OH+MxMR6SAYTdZCnGDEZph5wF8JAf8+XB2MDPzQxSLFzeepCaEsYT98iGsi1SrhMeYErH7mxKTd/2QKvDoMkddA5Ulu82xiEah40suJkKcswYWt3puFRAMBGm2sykKbmcrgKnIE8ByhlorRLC/0GpA/MkP5pwDvHF9Uumd2a5ApVnlXefjYiRxwTQ7/i8Lym/Z1E7mo4MNRLe+cn76pxDRfZnufyax4ysyuIzB7z4GIkZVTbJheNvWBZd8vHZd7prl0H+LrnyV2+/TUi9/XlAKyXX5oXbDgvoQudqdTCndncP6mjJ6tysS3JD1et/GBcXhu2CJ5Z+Tr7MqY0ioXfI55KhnTnPvwssXs5zxJ+rMH1mBjcynNwvlg4SUQi7jjRIcrDDIxQTo2361uSsm3tjxf4G2YcNWaajrDAN0rO3G/v7X15F/6D3/plqTrX+7f9IIo7eb3OXLFgbuBVxKnWP+Ep6Q5Uh5vN4/ViGKAFYV/Hq4SXyHfdM1CvpTjtWrZQE+aocRKdrCkkRVO0+xpC/TBMRWtypyaAYEh5hieAz5zGajgVp4L4R7s7lEESJ68Z9OESQ+ZdixY4I7gI64nPb7Ag2xj+u+IlddLyuzNTeX7zyLj9Z8fn+7cXKP77m8hTwoj2YglbFmssjO8abdw+DbVkEGSRf8Tj0HcZV71shXJ5+PnsONUGBwmJT6iorXrz70MHDz2t7N/TpYRb6RAuCJYApfmAUfSTUJyvaQGfSqrapzzqEbRCnqwNe2a35kG7ersMiHyKtcQBUh/r/lF1aK3QGDJLOFpdlURj4iwb5rCjtGqb7zLOG94ezfLu9vupg11eusWYMXY9zDC6 EIDYksw8 lI9ReqqD2lljdZf+YtcGT2bWyeZk/JatAh4MnJ4IHRoGw0Q+dHfjri6ktz5uN5xSMlx1rnLMGz3enAhQjB85QCLlfY9qz7qn/IBWDoSx/6fjXHDr+owUhCriHhFWQRx4jVcFxqXi1xvkY4quYo3YcBDn789l36FZtFlAvD0QZfyLmEE+Q2XBv6snDUbpJOdTeBb49cwIgpYw2rX2Y94vNIwXIudOfCwDDL+kGF6GVUmJONZXHpSOFIaogfWrA9UxJRFIcwfqRv76jaKAjiGC5dE8h83gg4fHx/CfLzilDJbb0IkDO6CLdyQvMsSsSMp80Xk55XKKPiiqVnhpXGmWlQ4tsalp0WV3M2Sk9 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: 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. For ext4, we only need to enable the FS_MGTIME flag. Signed-off-by: Jeff Layton --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index b54c70e1a74e..cb1ff47af156 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -7279,7 +7279,7 @@ static struct file_system_type ext4_fs_type = { .init_fs_context = ext4_init_fs_context, .parameters = ext4_param_specs, .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("ext4"); From patchwork Thu Jul 13 23:00:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312723 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 8E309C001B0 for ; Thu, 13 Jul 2023 23:02:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B6CB6B008A; Thu, 13 Jul 2023 19:02:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 167866B008C; Thu, 13 Jul 2023 19:02:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F22E88D0002; Thu, 13 Jul 2023 19:02:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E20C36B008A for ; Thu, 13 Jul 2023 19:02:02 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7A9F61C87E4 for ; Thu, 13 Jul 2023 23:02:02 +0000 (UTC) X-FDA: 81008113284.10.18EBC36 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 9B369140025 for ; Thu, 13 Jul 2023 23:02:00 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BS7k3xvm; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.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=1689289320; 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=Uf8fzofxnNcmoauKYc81EqlxvQyndJgVuHBZzE2ZMg0=; b=7hbHaY13mq1ydkU/WOu+0EHCOhqbOD8ySiBXqo053DBETEFJzDwEfBWIj5Z6yewDdbaZRm 7KSQNjIdj4xwQYHT6VVEc+bPK5pkOEuVGlXic8bEKu7tN7EBVrAatdZF3tVOcVvZCZMmBs DWzgDnnMPzmpLVxUte0yL9IjE1B/o3E= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BS7k3xvm; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.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=1689289320; a=rsa-sha256; cv=none; b=7ZeHsFQ9ssdleDhd4ApjTt4XuLO9pSEruWC1ASmAS/759PSPHyeDQhwHORthnrOUOM6Rt9 imj2hK90zuovYXKSFB5gE4YXxNE/hnlyAG4LUm1c+O2VJm0SScJjnE04P6nPskQxTe2g6U 30ViCGE1THsSklEOc5JER1ZFxxhCKyg= 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 BA1F561BB5; Thu, 13 Jul 2023 23:01:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F2C8C433BD; Thu, 13 Jul 2023 23:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289319; bh=t187d4hlj7Hd2B853hoiIPlXJE4vBx7O1lkOZGTYDW8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BS7k3xvm0kV8VQrl/+Nc8umWhgO+pb9JT0LHiIqUglobFvawLeTwqlzQHpVKTDZvB uzCvx/VSEkD7rBjIYWrgFJPCVeqzpiWP8yPt0omTj30LLcay2tknCTfGbRYu6T8MHO XUKoIaSo5n/Bd8IGVTxHqLGvMrjMe0fw+PscScTZ4jWUdNZ+2byzzdy+o175llL7m5 o50SLzukRXrSYzl6VaWT8ZrHwmm4KFENLB31WgFlIK5T2Pi03WKPiptSSMpQZPxFLm ct6V/7uDGKKjKZCyDiQclhCznfyT/lEVKO0vqyqaIX9NPJI1Mx1EUf0gKBJYoL63GW 31d2FfqFHu4Cw== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:57 -0400 Subject: [PATCH v5 8/8] btrfs: convert to multigrain timestamps MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-8-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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 , 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=2706; i=jlayton@kernel.org; h=from:subject:message-id; bh=t187d4hlj7Hd2B853hoiIPlXJE4vBx7O1lkOZGTYDW8=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIv0d3fY46+2hyVZzGgFlf73uVo9uOX8lOx6 K4UVJ9Da6yJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLwAKCRAADmhBGVaC FbztD/4uZXXSyTwCnSezUKeydXdyB1DOo4czPXF+iJ085mANTre9b4XbUvuEDf9bQijKjYvAiIF T6aBATLxstNxy4RGAHDXtSLWG232Ink6G1PNMhMC9R96FpJsuPjmMk8NUBog9j/mjyhM2PlaAMX tX5JL88Tb2gI1FbBxP6pQJCDRkYxbfydZ/FGNzZuAcvlJMt3BH7bGga81LPIjr5UOfLB+GnI8oe i5BFOw+r7A+Xu+KDGowTNXor3TGmR763yaM7A/mcig5Jp20jEJIXDGO1tVgSdAP0LebIstIif+9 kiMe/3MWPnPs0eVd+mEtYR53HfccdkA9ShOKV+Jx7qg5v2TSojDh7bRQBVb22NQZGRPBlgv2560 X83w+MU7yhsMU1MCxv2Whg6ooLLErWX5Zp68rM1FJYdQ/3YbvfDj6sg+4Aa3PF5ifwLM33BLCLr pXwEOeLySTL3OWSfSzMqbNqkSShHhPhxZs+ZtZsqAM1fTRTO3svFqI7T/IFjBt7NKwvQJKyhtIJ syGts3Gf66X08k1+2iwyGMuP2FA8o0TGMTCwUBXZtxQhhH4KlMpwsdFurHxhcT/j4CtVbSAH4Uc fB3KEuG+QiBPD89OSHahxCRhPa+vWgmHHVnmaRK/PJC6un6LOOBM1as6ikNxs/Lc9yixCPrHMNq /XZRVwDe3wtNV8A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 9B369140025 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: menq1oodoqfkczsyzwfrnqqm9sa5nc5a X-HE-Tag: 1689289320-710934 X-HE-Meta: U2FsdGVkX1+gDy7prk5A3YqkIi46ga82qE4OOHXu7NoSFvO1ApwPDWdOawfVqGOjhncrtrK5snpHdqrn5DwNJEXw1HXMl3HmFAt0tlzqT8qn75PW93Rw9yqWiFLGUprf1Gxj/gC6+SX+lac5piEtjgoRrY419ytlen/6T418abSg5ZWCMX6WB2P8AWtcOCFhIPCVhpkBwMsutcvs5sdZltT/GQlbgyUoSWnUbTNqgCKSDtxmV+ma2QXuObJefzXh8NRruwcPl+7rn6iLQpS5CcMt0+C7dRuWZdF9/zTuooUZ/L5zXrZ8aSefWFn86kO79FT8uPw8xUdwygoX/41FTuQg7tUv/FjTsLwX4vxKqcyVH08m2E4rjcrHP1bd8E9vmYnSU//NsT3zpqAiVZd2UU8CNVi7ORNl2yCuVq5oiLP5ur/vuQakPbo0y7jVeJ502nfPVjj1FYXSea61bYomoYUXwtJOo/k97VEzrHEaDnY+UJMrxO3Amtw8CeEL8uKoL6ZvnXsDrvPKa0aieleHZE/heReh5+Ds9Ndi/1f5pTXbruOiBGrXoNrkcLpHT7UnRkaQRcPUm4E1H+reF4eCuINFbSeolUW1v84xBs6kUTNq6ACHvoMH/OuvTHWIw3ecSD5LUG3LyHs3kbYMLbsp8glOpbskpPekzkUrDv+z/klLk3Hw/tsvoo/9eBnrqIfDqL8O0w9fHspjOopD1y9r5jVlYpuzlyoylsatPsGIbSl2BSIleH9n+KWMPrp5IlHnr9ljn8iLj9yCdl0ehue9Lq6OVZF+dn7058Rw0gdQX3sVtAoeh+yuzDZmIlG1sZoOhZiA7RBHxFYB9LNWsQZK1sIgRzOrfzk5Xwj2JaLGDcnOV/oyU4SVoFC24RfP6+MUaeTVWnPbi4vdvlw4wk+Yp7+Hoviy308O7uMmovss5vyV6tqJIPlaIqFjBLaw0pOlUGcxljqCuww622nWECz Ocu/2U28 pWU5iIuOBqgCwPwU0cuss+wVcXPzSVrwnFRzH4KLS5I2hm6BN/AljHLO+4hxAZZR0gm9JYYRoc6jHa4N+FqFCpRZttL+Ip3BV3b7VnMacrUA2M98KTz52m2O2iV1c0LtgSpaEaPPgmM1I7pjmbr2t2eiNsVUs8HbssTgH0sdVFRDQ2qGZ1yiS8BZqdT9R9zJwbWuAPi5F2viwToBN0fv2binAo9lTRVMHaFC+/okzt+2f1m/GwAA+iJPKfBuXOH8p/69nTMtDcdM5gBnBPmzZjFU8+7tKm9I1gr6Xoz+cljED6ArVoi/FfQjqxf+M2JVA1k49gkLXguS94GoXya7GDfV2nyUfxqgjJbWj 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: 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. Beyond enabling the FS_MGTIME flag, this patch eliminates update_time_for_write, which goes to great pains to avoid in-memory stores. Just have it overwrite the timestamps unconditionally. Signed-off-by: Jeff Layton --- fs/btrfs/file.c | 24 ++++-------------------- fs/btrfs/super.c | 5 +++-- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index d7a9ece7a40b..b9e75c9f95ac 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1106,25 +1106,6 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode) btrfs_drew_write_unlock(&inode->root->snapshot_lock); } -static void update_time_for_write(struct inode *inode) -{ - struct timespec64 now, ctime; - - if (IS_NOCMTIME(inode)) - return; - - now = current_time(inode); - if (!timespec64_equal(&inode->i_mtime, &now)) - inode->i_mtime = now; - - ctime = inode_get_ctime(inode); - if (!timespec64_equal(&ctime, &now)) - inode_set_ctime_to_ts(inode, now); - - if (IS_I_VERSION(inode)) - inode_inc_iversion(inode); -} - static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, size_t count) { @@ -1156,7 +1137,10 @@ static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, * need to start yet another transaction to update the inode as we will * update the inode when we finish writing whatever data we write. */ - update_time_for_write(inode); + if (!IS_NOCMTIME(inode)) { + inode->i_mtime = inode_set_ctime_current(inode); + inode_inc_iversion(inode); + } start_pos = round_down(pos, fs_info->sectorsize); oldsize = i_size_read(inode); diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f1dd172d8d5b..8eda51b095c9 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2144,7 +2144,7 @@ static struct file_system_type btrfs_fs_type = { .name = "btrfs", .mount = btrfs_mount, .kill_sb = btrfs_kill_super, - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA, + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME, }; static struct file_system_type btrfs_root_fs_type = { @@ -2152,7 +2152,8 @@ static struct file_system_type btrfs_root_fs_type = { .name = "btrfs", .mount = btrfs_mount_root, .kill_sb = btrfs_kill_super, - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | + FS_ALLOW_IDMAP | FS_MGTIME, }; MODULE_ALIAS_FS("btrfs");