From patchwork Wed Jun 21 14:45:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13287438 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 67FE3EB64DD for ; Wed, 21 Jun 2023 14:48:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C89AD8D0003; Wed, 21 Jun 2023 10:47:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C39CE8D0002; Wed, 21 Jun 2023 10:47:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B01F68D0003; Wed, 21 Jun 2023 10:47:59 -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 A062A8D0002 for ; Wed, 21 Jun 2023 10:47:59 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 74D8AA08EF for ; Wed, 21 Jun 2023 14:47:59 +0000 (UTC) X-FDA: 80927034678.25.F6362E4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 1666D18001A for ; Wed, 21 Jun 2023 14:47:56 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=f6kC0+Xz; spf=pass (imf16.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=1687358877; a=rsa-sha256; cv=none; b=XLRTv7WL9qJ2mMxXSAZc5GD87wreMXJ0aWoGBb3dJm4dUbFyQ2YdiKk8L4WyJWLlqLBc72 CU8ORxP78TB3iyR2Ldy69R0BgU2ybIPMRYIniV78MPzsozeNisBcEdvNqfJWi+qFJzAPGR u/WCgkMOJaYhrTwSBaqdp23TUQVM560= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=f6kC0+Xz; spf=pass (imf16.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=1687358877; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/PynAd+P+RV6CH2QEbpR5QUqRkFUwmsqDr+Pp80hxn0=; b=sTwz2kalXOzFKdBouXspJlzFIGLe4sFMUQC8lz9IwKT82sHI/sXdIpwCDs39TRwjPCV2ko LZ1Zm/gbjihCWwDVVXTLY+ckOe9WvSWBX0/+5X8Sx18tBgSYm9ksnvN9oI0kv0odXVj/WP VwesgwqMy9v9FK+ssgSvbcQZMa7XmI8= 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 23B6C6157B; Wed, 21 Jun 2023 14:47:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE27DC433C8; Wed, 21 Jun 2023 14:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687358875; bh=MMiHJmJBNyH0712JDFBQLINvQMhdjt5Al9Z5DaYQAOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6kC0+XzDaO9aaR2d2QH26S46NyMvGMFpyfpkUyHHnQZkNcVo2QR4IWpE10dRmx0c gJjBKfrFG3dK3aLxdi5ozDCdfXTOKbB/AHPWRwnqM0IgtZHpRPFd11A5wXuOfaPbTE DjpxYC6Sb5EXHL6Fau+1J77wBFTv3EsNz6XX0lnPdJgKk+H1YCCQeaihkWkvw2/g7D ysT4N+AhnHqmaWRjU8bDfSnB8wNRZRpujPwUQB1USSqCnE+BaSaypAUFshv0CMR/Ex fr7lcbdsvZl9zhdP5mjI28tAC39Z/qe8pW1hfVFLBLjy+lSo8bmtYPTFx9a+tY4XL4 mJLu49+a0gZmQ== From: Jeff Layton To: Christian Brauner , Alexander Viro , Eric Biederman , Kees Cook Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/79] fs: switch to new ctime accessors Date: Wed, 21 Jun 2023 10:45:25 -0400 Message-ID: <20230621144735.55953-11-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230621144735.55953-1-jlayton@kernel.org> References: <20230621144507.55591-1-jlayton@kernel.org> <20230621144735.55953-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1666D18001A X-Stat-Signature: f7z4u7a76868a3cra5syr4c1mi8x4oic X-Rspam-User: X-HE-Tag: 1687358876-662021 X-HE-Meta: U2FsdGVkX1/Gzc8hioYkh2PQ0ur0BTVyLJjBTNKa6VOyj03hiGge6+i2MUU4JyPADXLaIvbr7N7rTaBjbfNH4gEUoY+6CUd4UkZJXV0fo0lFbriRGqtXz32CB0PaOf5JvWgUGH3Ktr+/iIAU59N6pp601yiZjvTxa3UCDRonKvWPUeMnCYZrhENLiAwjexrZZy7slF2fTeKsUgcSkzXtlNDWdoxentkVEPsF8uvKw+xjMr+B8QFU+CcKF7fCQDL8QDsy7zOn0ta+yM6ry1VrOIgUOrSl61YN8I4APHPKvTEoXLt2z/bZASI30iZj9JL2K1wZTxuqPgrmfuID9i2BIr73evyLf9osoSxDFyLIqzh9woe8nzBrYrxLvLHqL68f8DfKq8engb44aFWX4AuscZIjScdPFUvWjL9L/sjPMzOHX4BG1yt3cUZSYkflrZ8Jz3AjT+7TbEZxYKeQQNeVQRTn27Mrp0XM0dvt45zbNJ1UnPATOBBlZTLFRylc0tE3ghR9NYa1FvIc+6XbJa4eoQJw1WNO6Vvh7gllbiI7ZgyXRs4C8fqvpFVoSLuIjPES0BT0j8Iti9USmZh1w1uMboR+jSBr0S5gN9k9VmgK2p91yiuZAirvEDmof7Iewd8Fe+nJMzqjVwVDp0MLQSsBfbqHjghsNrZp8jf79DCgtMvJZrQnMV+T9ibzEgGQ4yol2kOIpX88sZJ1ZK3PVdubhZuCeLj0UdfzLYITKtYYlJ3A7+TDOC89mnnsL8WqfkeUndGIBE2oXxBvWH2mTffTsaYnnUq+4HWada7cVRxIMWCikxgzjlzbaZD5YMFhQsQGgQG6jEO5prbeApat8hbbGJqsfIWC5k6dO9yAcid/M7VPvVWvI3gyqhYZxWGvG8JZbA2KG4KBKePlXN4WM27+tEhBgpWXhLA7pHu8TvNQQQrNTe7Pm+ldxwzDrWTM09URQJikpVBfGASO3ZkN5EM 9CqNfZIB MTqaS8G8v+kiLzWxmtkx+kjbcOHHSPiREKghP+FIONs5bh33z5wzukdEPv/FpooYCr/70cTrta/6p7HhtyB4uXwT2+AzifVGifCT114QQ0Ck4wy17qc7CyESAyClQt1dxjXWekz7AXDhK/aLO15hmLK480vYoriphjcWFkqzrwEoJyewTsGsWfgunVHkUjtR95bX8o6UMXWaQLSdSybuq/KAwQlnPQ4wBrFkp6yaVZFnpz9mFbnf2M1r3sIz5g/L3tIPGSIBJyH+A9F41FAHG8+8nxj+VFlMY6zuwq2qweA2Ovr78gYdTh30J2p6/pw+cMX1M4qyduCe06QtWXchTTkFhZA== 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: In later patches, we're going to change how the ctime.tv_nsec field is utilized. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton Reviewed-by: Jan Kara --- fs/attr.c | 2 +- fs/bad_inode.c | 3 +-- fs/binfmt_misc.c | 3 +-- fs/inode.c | 12 ++++++++---- fs/libfs.c | 32 +++++++++++++++++--------------- fs/nsfs.c | 2 +- fs/pipe.c | 2 +- fs/posix_acl.c | 2 +- fs/stack.c | 2 +- fs/stat.c | 2 +- include/linux/fs_stack.h | 2 +- 11 files changed, 34 insertions(+), 30 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index d60dc1edb526..2750e5f98dfb 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -312,7 +312,7 @@ void setattr_copy(struct mnt_idmap *idmap, struct inode *inode, if (ia_valid & ATTR_MTIME) inode->i_mtime = attr->ia_mtime; if (ia_valid & ATTR_CTIME) - inode->i_ctime = attr->ia_ctime; + inode_ctime_set(inode, attr->ia_ctime); if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; if (!in_group_or_capable(idmap, inode, diff --git a/fs/bad_inode.c b/fs/bad_inode.c index db649487d58c..bd3762e1b670 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c @@ -209,8 +209,7 @@ void make_bad_inode(struct inode *inode) remove_inode_hash(inode); inode->i_mode = S_IFREG; - inode->i_atime = inode->i_mtime = inode->i_ctime = - current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); inode->i_op = &bad_inode_ops; inode->i_opflags &= ~IOP_XATTR; inode->i_fop = &bad_file_ops; diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index bb202ad369d5..6af92eb1b871 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -547,8 +547,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode) if (inode) { inode->i_ino = get_next_ino(); inode->i_mode = mode; - inode->i_atime = inode->i_mtime = inode->i_ctime = - current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); } return inode; } diff --git a/fs/inode.c b/fs/inode.c index c005e7328fbb..a7f484e9e7c1 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1851,6 +1851,7 @@ EXPORT_SYMBOL(bmap); static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, struct timespec64 now) { + struct timespec64 ctime; if (!(mnt->mnt_flags & MNT_RELATIME)) return 1; @@ -1862,7 +1863,8 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, /* * Is ctime younger than or equal to atime? If yes, update atime: */ - if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0) + ctime = inode_ctime_peek(inode); + if (timespec64_compare(&ctime, &inode->i_atime) >= 0) return 1; /* @@ -1885,7 +1887,7 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags) if (flags & S_ATIME) inode->i_atime = *time; if (flags & S_CTIME) - inode->i_ctime = *time; + inode_ctime_set(inode, *time); if (flags & S_MTIME) inode->i_mtime = *time; @@ -2071,6 +2073,7 @@ EXPORT_SYMBOL(file_remove_privs); static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) { int sync_it = 0; + struct timespec64 ctime; /* First try to exhaust all avenues to not sync */ if (IS_NOCMTIME(inode)) @@ -2079,7 +2082,8 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) if (!timespec64_equal(&inode->i_mtime, now)) sync_it = S_MTIME; - if (!timespec64_equal(&inode->i_ctime, now)) + ctime = inode_ctime_peek(inode); + if (!timespec64_equal(&ctime, now)) sync_it |= S_CTIME; if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode)) @@ -2510,7 +2514,7 @@ struct timespec64 inode_ctime_set_current(struct inode *inode) { struct timespec64 now = current_time(inode); - inode_set_ctime(inode, now); + inode_ctime_set(inode, now); return now; } EXPORT_SYMBOL(inode_ctime_set_current); diff --git a/fs/libfs.c b/fs/libfs.c index 5b851315eeed..4a914f09fa87 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -275,7 +275,7 @@ void simple_recursive_removal(struct dentry *dentry, while ((child = find_next_child(this, victim)) == NULL) { // kill and ascend // update metadata while it's still locked - inode->i_ctime = current_time(inode); + inode_ctime_set_current(inode); clear_nlink(inode); inode_unlock(inode); victim = this; @@ -293,8 +293,7 @@ void simple_recursive_removal(struct dentry *dentry, dput(victim); // unpin it } if (victim == dentry) { - inode->i_ctime = inode->i_mtime = - current_time(inode); + inode->i_mtime = inode_ctime_set_current(inode); if (d_is_dir(dentry)) drop_nlink(inode); inode_unlock(inode); @@ -335,7 +334,7 @@ static int pseudo_fs_fill_super(struct super_block *s, struct fs_context *fc) */ root->i_ino = 1; root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; - root->i_atime = root->i_mtime = root->i_ctime = current_time(root); + root->i_atime = root->i_mtime = inode_ctime_set_current(root); s->s_root = d_make_root(root); if (!s->s_root) return -ENOMEM; @@ -391,7 +390,8 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den { struct inode *inode = d_inode(old_dentry); - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); + inode_ctime_set_current(inode); + inode->i_mtime = inode_ctime_set_current(dir); inc_nlink(inode); ihold(inode); dget(dentry); @@ -425,7 +425,8 @@ int simple_unlink(struct inode *dir, struct dentry *dentry) { struct inode *inode = d_inode(dentry); - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); + inode_ctime_set_current(inode); + dir->i_mtime = inode_ctime_set_current(dir); drop_nlink(inode); dput(dentry); return 0; @@ -459,10 +460,10 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry, inc_nlink(old_dir); } } - old_dir->i_ctime = old_dir->i_mtime = - new_dir->i_ctime = new_dir->i_mtime = - d_inode(old_dentry)->i_ctime = - d_inode(new_dentry)->i_ctime = current_time(old_dir); + old_dir->i_mtime = inode_ctime_set_current(old_dir); + new_dir->i_mtime = inode_ctime_set_current(new_dir); + inode_ctime_set_current(d_inode(old_dentry)); + inode_ctime_set_current(d_inode(new_dentry)); return 0; } @@ -495,8 +496,9 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir, inc_nlink(new_dir); } - old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = - new_dir->i_mtime = inode->i_ctime = current_time(old_dir); + old_dir->i_mtime = inode_ctime_set_current(old_dir); + new_dir->i_mtime = inode_ctime_set_current(new_dir); + inode_ctime_set_current(inode); return 0; } @@ -659,7 +661,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic, */ inode->i_ino = 1; inode->i_mode = S_IFDIR | 0755; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; set_nlink(inode, 2); @@ -685,7 +687,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic, goto out; } inode->i_mode = S_IFREG | files->mode; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); inode->i_fop = files->ops; inode->i_ino = i; d_add(dentry, inode); @@ -1253,7 +1255,7 @@ struct inode *alloc_anon_inode(struct super_block *s) inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); inode->i_flags |= S_PRIVATE; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); return inode; } EXPORT_SYMBOL(alloc_anon_inode); diff --git a/fs/nsfs.c b/fs/nsfs.c index f602a96a1afe..c052cc55eacd 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -84,7 +84,7 @@ static int __ns_get_path(struct path *path, struct ns_common *ns) return -ENOMEM; } inode->i_ino = ns->inum; - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); + inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode); inode->i_flags |= S_IMMUTABLE; inode->i_mode = S_IFREG | S_IRUGO; inode->i_fop = &ns_file_operations; diff --git a/fs/pipe.c b/fs/pipe.c index 2d88f73f585a..bb90b6fc4a96 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -899,7 +899,7 @@ static struct inode * get_pipe_inode(void) inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); return inode; diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 7fa1b738bbab..cc9c390fd2af 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -1027,7 +1027,7 @@ int simple_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, return error; } - inode->i_ctime = current_time(inode); + inode_ctime_set_current(inode); if (IS_I_VERSION(inode)) inode_inc_iversion(inode); set_cached_acl(inode, type, acl); diff --git a/fs/stack.c b/fs/stack.c index c9830924eb12..efd0de85bace 100644 --- a/fs/stack.c +++ b/fs/stack.c @@ -68,7 +68,7 @@ void fsstack_copy_attr_all(struct inode *dest, const struct inode *src) dest->i_rdev = src->i_rdev; dest->i_atime = src->i_atime; dest->i_mtime = src->i_mtime; - dest->i_ctime = src->i_ctime; + inode_ctime_set(dest, inode_ctime_peek(src)); dest->i_blkbits = src->i_blkbits; dest->i_flags = src->i_flags; set_nlink(dest, src->i_nlink); diff --git a/fs/stat.c b/fs/stat.c index 7c238da22ef0..5d87e34d6dd5 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -58,7 +58,7 @@ void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode, stat->size = i_size_read(inode); stat->atime = inode->i_atime; stat->mtime = inode->i_mtime; - stat->ctime = inode->i_ctime; + stat->ctime = inode_ctime_peek(inode); stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; } diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h index 54210a42c30d..1488a118fe91 100644 --- a/include/linux/fs_stack.h +++ b/include/linux/fs_stack.h @@ -24,7 +24,7 @@ static inline void fsstack_copy_attr_times(struct inode *dest, { dest->i_atime = src->i_atime; dest->i_mtime = src->i_mtime; - dest->i_ctime = src->i_ctime; + inode_ctime_set(dest, inode_ctime_peek(src)); } #endif /* _LINUX_FS_STACK_H */ From patchwork Wed Jun 21 14:45: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: 13287439 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 00C8EEB64D7 for ; Wed, 21 Jun 2023 14:48:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92E158D0005; Wed, 21 Jun 2023 10:48:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DE928D0002; Wed, 21 Jun 2023 10:48:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CD578D0005; Wed, 21 Jun 2023 10:48:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6E5BF8D0002 for ; Wed, 21 Jun 2023 10:48:46 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3D8C81201DA for ; Wed, 21 Jun 2023 14:48:46 +0000 (UTC) X-FDA: 80927036652.12.0B71F9F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id 4F20F180024 for ; Wed, 21 Jun 2023 14:48:43 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hSKmtL7G; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.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=1687358924; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VkD0/8U7N9zK9X6y4pHc5meZAbDYPgt0B5Cze4gXUyY=; b=sS96ghT1aR/Rkb4LksGaV/K2LHOjwKPU8+J1k68/nzCMjwoPCS1x2WK5Z/ekQP05wHNrwk Rd1qUXXej+Hz6/TLhRo+dy2R09ZyvGX+s8zv3BKMOzBW7aI/5yLdL5C5i4ip0On0oXBSxj UpHIqTqSi0+NEjoXYHlugR9+6DF/M/0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hSKmtL7G; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.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=1687358924; a=rsa-sha256; cv=none; b=6wlXw/csd4NTXThffFKRWvXMBUn37qFEE2t+F9xHaFrvsBekChb1f4jVg4JiJjWGAlUQb6 nBERxz74tX6AyYx4r4HyPF4VJDrzQuc4df5pYTizpO9eHkJoY0CGKreCx1HdV8mlLI9br6 aP1fWDSDCbRUt70+2H0OkBMCgsFTNK0= 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 40DA461594; Wed, 21 Jun 2023 14:48:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3B23C433C0; Wed, 21 Jun 2023 14:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687358922; bh=UvNq+M9oth0ZwLvHaFU15fGRvb6agUkybQaQqyNXMdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hSKmtL7GOzh8ryKxNvlPtCPaMYjdREurFTyaiU4tT/RKIG0YTrSJ2eVDf3SEBiyMq j5WmOAz0nBbsqQfrOq+RV9ZFdzGj1d+9E3epTOFd4lMEcakc46syFOL9LuADxQIWNj a+f9l8ReAu1jL/NzHaH06oT/DyIYYozoWFslZ+exTUcRJ0B4bOcut3FgOsYyirXx50 5eTemc9IpO6dKCthte5LY8lHUUuYVglt9Yrk//4n8zNrQXKDaPd3q8Yx8cN5VTO1mc pdfRxg4A8WDnTh9BC1E37C3xAPk7o3WbgPYzbRVmhobR/726zRgQebtcbA0AlPP1Qx R2XH4puSJLm5A== From: Jeff Layton To: Christian Brauner , Mike Kravetz , Muchun Song Cc: Al Viro , Jan Kara , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 39/79] hugetlbfs: switch to new ctime accessors Date: Wed, 21 Jun 2023 10:45:52 -0400 Message-ID: <20230621144735.55953-38-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230621144735.55953-1-jlayton@kernel.org> References: <20230621144507.55591-1-jlayton@kernel.org> <20230621144735.55953-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4F20F180024 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 5644xrwj9qpackqaknnk1epshjogho1h X-HE-Tag: 1687358923-207105 X-HE-Meta: U2FsdGVkX19w12kE3mkCy5SKIMa8Z4ZkA6nj6Lwc0v2YwWpldSJIYPtxkLd9XV+4ELFqvX6iaH7Z0loYQZMjTs8CnpZFI65coU180GpdXEHFeTTerDofu535K3wLPLE9JBSNrtjpAXr2BRdZ87G9k1NK15sauxYDnEqyCN+lviQNlBiNra/ha67qmmriyTrV+DDvme5CfxfX0oH7uYEaYrlgZaBBtgssnbChqq0K9MZIZq80e6lEVepBbCdZF3unUCd8DvcOHM56v38wL2g9fAfngW5wRvawSGPWkNRxCwlR2+9bsf2qOtvBArQbhcCLDIQ5iVaAn2VhiZcQSX8+nvxt49mSOVXDqmZ3LKCLJZqJ4WOkyPDyMyiRtZgRniOnUJTLYavgxmRnauqe+kg3gkczjjKbGgttgqbtcFvJSx23ieNHR4ob3wiymS78xcCSUrPOHNtbAHViahiPBd7+cIfntoddeGHz+xz8xVV++b/3BnFRNPrcIjojpmb1DEk2cbDaHTVY+DI/NIHIIyHDQ6H9LXLver/Ikg1f5oXtMORc0XQu0zolAqG4lBotpRZgS/OM9hnlm+8aiAlSQtQWsgvoEwPx85TupC6pcFEKg+2q1+zRWeipAFq73GVIQ5ZdaVAvOO+5A//HkQpVvDQIrUrHMbkHtJylz5I6uJy6JA6rU3VyTYQ8SmEZSlUHX8oMgj8J0jEczDWR+Vd3VJAxj81AUAFKydLfovqasIP29Tibe7drIup96n0oFUSam5idGPD/Ji61xIzUTcHCTPfQoWHCd7kc+7PUXq0qgqB5ORFFXc6ANfj0yKnD9JS7/4vMUQH44AzpnhZh4ACdh/ILVSQ9CkR1oLZLEnGbJ0RSM5VlmGb03NqLY3wN9fTAPeggGZ+v6NvDLPnYACe6WiG8McyEAy9mtvTyRihmB9tczPGQqcTyrXyBCd8HWUYUqA8D7gbNVIbfMGsEXUrvrkr afDWvPLj hpnaC74NtbwHsvcRp9E2SnEzYHBVqvr0imngd9KOi2B7MyRasVuFAOSlR9qNxb6U/lls9F03QnoiAr6n+OaAtQsh8dIyvALXldz1ge5LFT/vRfnj2BI7RLuBBSur8wTpQsJ1B6DXQoi5mOsRpiDj/oD3RYImDOJ+3M2SekcLbvWFkfa9/R8xiVmnURilXgjaIrq+b+gaBZIIsjn4nWJXYPYgo2czc/Oxs+EnTsQGixeWo8PTgsA9gvmiGIc3z3CiY6nBToEhaSlC+DY0E1QJrc5SO0TtCVvmArKwJDpnLUOgZjDVzmSQgzIkCesYfOqNf5nd2xegL0leXSqZ6TpV+aBFBoQ== 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: In later patches, we're going to change how the ctime.tv_nsec field is utilized. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton --- fs/hugetlbfs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 90361a922cec..7be5a8f5927f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -889,7 +889,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) i_size_write(inode, offset + len); - inode->i_ctime = current_time(inode); + inode_ctime_set_current(inode); out: inode_unlock(inode); return error; @@ -937,7 +937,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb, inode->i_mode = S_IFDIR | ctx->mode; inode->i_uid = ctx->uid; inode->i_gid = ctx->gid; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); inode->i_op = &hugetlbfs_dir_inode_operations; inode->i_fop = &simple_dir_operations; /* directory inodes start off with i_nlink == 2 (for "." entry) */ @@ -981,7 +981,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, lockdep_set_class(&inode->i_mapping->i_mmap_rwsem, &hugetlbfs_i_mmap_rwsem_key); inode->i_mapping->a_ops = &hugetlbfs_aops; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); inode->i_mapping->private_data = resv_map; info->seals = F_SEAL_SEAL; switch (mode & S_IFMT) { @@ -1024,7 +1024,7 @@ static int hugetlbfs_mknod(struct mnt_idmap *idmap, struct inode *dir, inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev); if (!inode) return -ENOSPC; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_ctime_set_current(dir); d_instantiate(dentry, inode); dget(dentry);/* Extra count - pin the dentry in core */ return 0; @@ -1056,7 +1056,7 @@ static int hugetlbfs_tmpfile(struct mnt_idmap *idmap, inode = hugetlbfs_get_inode(dir->i_sb, dir, mode | S_IFREG, 0); if (!inode) return -ENOSPC; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_ctime_set_current(dir); d_tmpfile(file, inode); return finish_open_simple(file, 0); } @@ -1078,7 +1078,7 @@ static int hugetlbfs_symlink(struct mnt_idmap *idmap, } else iput(inode); } - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_ctime_set_current(dir); return error; } From patchwork Wed Jun 21 14:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13287440 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 5D664EB64D7 for ; Wed, 21 Jun 2023 14:49:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E11508D0003; Wed, 21 Jun 2023 10:49:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC0038D0002; Wed, 21 Jun 2023 10:49:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD60B8D0003; Wed, 21 Jun 2023 10:49:48 -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 BD7138D0002 for ; Wed, 21 Jun 2023 10:49:48 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 74E931C84B2 for ; Wed, 21 Jun 2023 14:49:48 +0000 (UTC) X-FDA: 80927039256.22.3A4505D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 871FC4002B for ; Wed, 21 Jun 2023 14:49:46 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vFGsyrgq; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.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=1687358986; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3wI1FotU3VTqXLiliGTvn7irpD4LlKRhlI8DOB7eB8s=; b=LXXA2hJ9qxihICbR2He5KzpiaZJvjDHHSB2PK+z1tCBGj8msCL7AQzSrX34rH2sIhJVKBn xpjkRnyafkUfO91r56Pzqrz7oEd1E5KaJdQCIqmvPSAbFu6/QuBZw/EYD8NyxSJtkcKcNX gQezQ3RghKyLxHd+NqWDGvaCIkdjf38= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vFGsyrgq; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.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=1687358986; a=rsa-sha256; cv=none; b=kp6dOP7rkpL4ce6YRMB0a1rtzKCVxEFpSyW8y/Ia1otKML4Y2+BC7BUbnaFSVIj4p6GNtX swDwj+6434dOHgJ1hlyzLMb4E9Fp8DUqCvbwOcYWSrMAO0i+Bb/kyKRjD43EG3D24mNpMV 1RRT3ArQAFhHBWG/Rjm4q/IgmvdBlKA= 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 C71C2615CC; Wed, 21 Jun 2023 14:49:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A48FEC433C8; Wed, 21 Jun 2023 14:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687358984; bh=rf2ZGKofEWdIrdzCw9fnlqHLrcKo5aaZCkZqt6T8HY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vFGsyrgqrZj9JG6n3lwXYoh17JzM5aGaXfMaXhu8JYQJbeWxMESNSVX+/Cy+0mIEb xrfuJbHf2/jnTyanOxmsNb+PW2TJ30MJEC0p4pb9QhJU+4THKGpleOax60RFFGyFPv gXpPqI6dtzGaGDQc/FjNC/nbT7F8IFwo4QT6uiADNbBG0gWtNm6k0eeMAbL7OrZa+o R7WJt7wWt/ylML88EArNa50Nm1t6aFjCxmjad+Dt6VkPqsEssRWfKj6X2i+1JHaNoO 0HSt7UeZhqnkvwXFmr/UrKldM1Ro0pFRnhO0s3L9gCxOVgpmOvB0Hq/L1O0eHfw5Ls sUhw8iaL9Izww== From: Jeff Layton To: Christian Brauner , Hugh Dickins , Andrew Morton Cc: Al Viro , Jan Kara , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 74/79] shmem: switch to new ctime accessors Date: Wed, 21 Jun 2023 10:46:27 -0400 Message-ID: <20230621144735.55953-73-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230621144735.55953-1-jlayton@kernel.org> References: <20230621144507.55591-1-jlayton@kernel.org> <20230621144735.55953-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 871FC4002B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 1ujcxmex19pdoj63x3k6xdno7j5orfxx X-HE-Tag: 1687358986-725473 X-HE-Meta: U2FsdGVkX18revLcLMe2Ik3sibFTlg8P7pAkTNU1mZ31LrFzhLjJ2XSWPmiXKOyGPn5ubzCib8wmpDYpeQOx/V1XBwm1PmcdjyNky0gP3P7fXSmbL6YGALlZgQIzXVNShW4Vy4XXt3kkHuJ/pdohnwW1qnyTvXCmc8ItWukYW7LHLn3xk2I7hfOfzbHuIpPSr4/n63WX4H+N43gqBQpg2bq+nVQWbYZTHYr7OZPrmvIn4ZZ4t8IFxT5RKBi4lQUZ+x6CizyFOqVB4fHYijfr0NrElhYop386xpEr5H9hv8nJcsY1eNNKatZIAv2+ATO11bdrtnKYKK1ghCZngYRE/MKMp5rklhUCgaj0SQKVN95alX6Vp80d5z9Zs2Poemeh/h3noyA6cDuHnAkMto/ryPck2/zZJ+Di10PTOfvk5Ziyf9L6du6XhEzUhW1oqOtZGaEoPFJ8OVDk7WwHo3I6VSsa95uxYW2d+xA8iPe9rdL+2wk4od0tcBqg6TGPcKm7/+cMlif2j6JiZ6fhk78QPL1rqaPu+8NzmqQf2rWO6iwKK0azfVyaKjeLIkCiOfpYw2/icuTtYCuyzK1YXeNDMdN7M/XAyTSl/+mYxEtdOYtfaMu2yk1vdla+LiHtmf2IWwVyKdec6dVYwEHG50QB+RQIvvLey4Etcju3Nwv0ackSsPOUoQpOS2fbnko4S6jRvcenarDQFWgGLKmCCWoWJDcRDwvKauwIjTQ5ERNwHglYVwukqNPBuVgdj9nGHyFZ/KpBITtYK5BVPZj8v9vvht/QUBE66DapexkS7HUMof6PMrFP6Wz/8/hOmuaHmgvPJ/I2rhinaCUCfQKuHYqNUpg2oAyq3FDccymJqpGFvSCb0zQ4+f3tsrO6F2iTLHfS+eca0nV7DaYoSO/QBr6VXC/owlLSWvcMAVJc8t3wp/HW13gZUK+XRmb1pJQ9apm/5pFIMcKkhk9TVrVwlQV YfM2LG7c MNDoT75wVhR+U/pX18wLfJ+kI/ypiGy2tXp4NLG6dPB6zrpT7vvIRsevH0aSWG5ukvgFCmRVnlJ5afTJhMcCwUnSWiHdV2sYMs3HDxgZvWQa8U9vZ5bvPL+vAK0mQCrexHzXup+UVfOT1ZSaWRTa/TshVCxc88JDj6zHO3BMfncBB+VAh2JhdGI4qZwFX2Dh/spRigyNWsDfXhvRsMo3dn38Um+CeuI2U5iyioJO8NDrBDZjoRSua0LIf+7yov4fUx/mhRgSW7OowTQu9KIgUqGfPa7YvWIZjWf0csgGN/tajvkksAR9p9LWyQjsO4Tg8JqiIz4Og3camY65WN/22PX6fkg== 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: In later patches, we're going to change how the ctime.tv_nsec field is utilized. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton --- mm/shmem.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 4752084720b2..4979cb3e37e5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1064,7 +1064,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend) { shmem_undo_range(inode, lstart, lend, false); - inode->i_ctime = inode->i_mtime = current_time(inode); + inode->i_mtime = inode_ctime_set_current(inode); inode_inc_iversion(inode); } EXPORT_SYMBOL_GPL(shmem_truncate_range); @@ -1161,9 +1161,9 @@ static int shmem_setattr(struct mnt_idmap *idmap, if (attr->ia_valid & ATTR_MODE) error = posix_acl_chmod(idmap, dentry, inode->i_mode); if (!error && update_ctime) { - inode->i_ctime = current_time(inode); + inode_ctime_set_current(inode); if (update_mtime) - inode->i_mtime = inode->i_ctime; + inode->i_mtime = inode_ctime_peek(inode); inode_inc_iversion(inode); } return error; @@ -2389,7 +2389,7 @@ static struct inode *shmem_get_inode(struct mnt_idmap *idmap, struct super_block inode->i_ino = ino; inode_init_owner(idmap, inode, dir, mode); inode->i_blocks = 0; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode); inode->i_generation = get_random_u32(); info = SHMEM_I(inode); memset(info, 0, (char *)inode - (char *)info); @@ -3101,7 +3101,7 @@ shmem_mknod(struct mnt_idmap *idmap, struct inode *dir, error = 0; dir->i_size += BOGO_DIRENT_SIZE; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_ctime_set_current(dir); inode_inc_iversion(dir); d_instantiate(dentry, inode); dget(dentry); /* Extra count - pin the dentry in core */ @@ -3177,7 +3177,8 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr } dir->i_size += BOGO_DIRENT_SIZE; - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); + dir->i_mtime = inode_ctime_set_current(inode); + inode_ctime_set(dir, dir->i_mtime); inode_inc_iversion(dir); inc_nlink(inode); ihold(inode); /* New dentry reference */ @@ -3195,7 +3196,8 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry) shmem_free_inode(inode->i_sb); dir->i_size -= BOGO_DIRENT_SIZE; - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); + dir->i_mtime = inode_ctime_set_current(inode); + inode_ctime_set(dir, dir->i_mtime); inode_inc_iversion(dir); drop_nlink(inode); dput(dentry); /* Undo the count from "create" - this does all the work */ @@ -3283,9 +3285,9 @@ static int shmem_rename2(struct mnt_idmap *idmap, old_dir->i_size -= BOGO_DIRENT_SIZE; new_dir->i_size += BOGO_DIRENT_SIZE; - old_dir->i_ctime = old_dir->i_mtime = - new_dir->i_ctime = new_dir->i_mtime = - inode->i_ctime = current_time(old_dir); + old_dir->i_mtime = inode_ctime_set_current(old_dir); + new_dir->i_mtime = inode_ctime_set_current(new_dir); + inode_ctime_set_current(inode); inode_inc_iversion(old_dir); inode_inc_iversion(new_dir); return 0; @@ -3339,7 +3341,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, folio_put(folio); } dir->i_size += BOGO_DIRENT_SIZE; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_ctime_set_current(dir); inode_inc_iversion(dir); d_instantiate(dentry, inode); dget(dentry); @@ -3411,7 +3413,7 @@ static int shmem_fileattr_set(struct mnt_idmap *idmap, (fa->flags & SHMEM_FL_USER_MODIFIABLE); shmem_set_inode_flags(inode, info->fsflags); - inode->i_ctime = current_time(inode); + inode_ctime_set_current(inode); inode_inc_iversion(inode); return 0; } @@ -3481,7 +3483,7 @@ static int shmem_xattr_handler_set(const struct xattr_handler *handler, name = xattr_full_name(handler, name); err = simple_xattr_set(&info->xattrs, name, value, size, flags, NULL); if (!err) { - inode->i_ctime = current_time(inode); + inode_ctime_set_current(inode); inode_inc_iversion(inode); } return err;