From patchwork Mon Aug 7 19:38:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13344815 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 A0BA7C001DB for ; Mon, 7 Aug 2023 19:39:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D29C6B007B; Mon, 7 Aug 2023 15:39:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35B546B007D; Mon, 7 Aug 2023 15:39:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AEDB6B007E; Mon, 7 Aug 2023 15:39:36 -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 0A8926B007B for ; Mon, 7 Aug 2023 15:39:36 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D91CD16071B for ; Mon, 7 Aug 2023 19:39:35 +0000 (UTC) X-FDA: 81098323110.30.A2CF937 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id E1221180005 for ; Mon, 7 Aug 2023 19:39:33 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=To4OoZRw; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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=1691437174; 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=V7VUV40AHb30+wl7s1L9oeo+r+o83Q0MloeOa8M3GeQ=; b=rwLhsUiMH7xcwGREC9XEQY/7MQF6Ig4RcYkhk0W3euzRhOe/OpfNRkpFJ4+/ob3ENajStC HrHugwmy2svYvwHBXFJmZQRez/90jQZjgWvYo9ls+QT3rkcAaAdPaWdHTUCjW4U4qOGFLd mjPqBI2QKQUkfTFylutjumMc/6kZ5wA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=To4OoZRw; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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=1691437174; a=rsa-sha256; cv=none; b=32Ar7yx2CDDOQ4iwLu03t2KTZZDdMSu1uXSQZVMlM7Xuh6G8XmM10Ha9vBoM6BU/XG4kic bE9cLiQ9FCjNTWICc9lqnM6BQRQDVS5ydDxjMtqJZ7hzPddjMJxygfacP3oGAhk9aCxr92 TwYeXBDEhZJosr2lsIyXtGCdnKkb20w= 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 1E0CF621C0; Mon, 7 Aug 2023 19:39:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15E95C433AD; Mon, 7 Aug 2023 19:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691437172; bh=BbICkmDBBgSwVYXS6EZd0IrAvg6Sna2OcPY/ygsvt9A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=To4OoZRwZMZhtMOzlC110JtHszU7IBQi+eF0kpdySXfLmiqOD0w0yv+SVbm9/RWPW 6+qTqh7chbUbK1cB7KNEd7CzthwW3pvOWmnzVy/F0HEB3bKBfYzPz5sGkAwAvIzz7B YtwY/TdyqI39hIdIUyKejqo7jet75+X94OKSM2cIBBFpshpVckDv04dsV4FjoR+Ij/ fqREz9gj2E4mhd6RDJ+zkFdH3IjF/iknH4D7DA/h2OV3jG1JxbM50o3qRbPjdQhIsi 51mY/jMlCA/D65p0sDAVkB5bJM4sjLRSG+kwLJ+3ZKphnRpcdJjMaGhbgcd3Cr2dgG 7x5nw+HV/Yhbw== From: Jeff Layton Date: Mon, 07 Aug 2023 15:38:38 -0400 Subject: [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp MIME-Version: 1.0 Message-Id: <20230807-mgctime-v7-7-d1dec143a704@kernel.org> References: <20230807-mgctime-v7-0-d1dec143a704@kernel.org> In-Reply-To: <20230807-mgctime-v7-0-d1dec143a704@kernel.org> To: Alexander Viro , Christian Brauner , 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 , 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 , Amir Goldstein , "Darrick J. Wong" , Benjamin Coddington Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, 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-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-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1281; i=jlayton@kernel.org; h=from:subject:message-id; bh=BbICkmDBBgSwVYXS6EZd0IrAvg6Sna2OcPY/ygsvt9A=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBk0Ug+aVcwKVBDp9E8rOPtssDQbh7IcGxvS0rwI c1S2hBt9TuJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZNFIPgAKCRAADmhBGVaC FSPAEACPlCK3EgTnJat9G2lrCllZiR9HeXocxcWOoiDdqnOhA+LCdHCG7FPdv/tU6u5WnxoUH7B ARY5BR/8sjxizcFksE2rWBMWCvo/lCt3fEvv/TumLj+HamcwMPPGMuPB/bHhgM4O53ozb4mxyXc lBk42qVLhXQ3MpJKcdrAWqVbo5LnY8ffNoMTI9BljHoAWIZZA/FjxrWUD10PTuyI/p95JNSIDCB 6MjkGDIc9Aa41sfJVYJIe8fYFiGCsBhIgJwOYv44zu1wI4AJx5ZynU4UbweZHqkp2dc8U17oDEG 8MZvUycGi4MbEufJuFsQMH4rn7w9ETKsguIBXgoT/zt3aRI/dhj4ZBfQcMCgJXkbBEqz0K2cQx9 tUWV8oyU96vyxSzufIbhSczkroS2v5Uk9TpTq21U2Q3/lLA0Kh02dmR+sN5DgRGjgs8PcsIyumE D+5GYVvwgcyhHgdLN2ZLUDDOYzxGk0zl8gn1BuXb0iVHMlEjajc701wdqK191Yz1E8OOA8mx5Gz /ZWTo657yfwR4rLHHNlU2jA2S3EjuD9deqANKCDsth+oSL7VOVcmdG+vA7CwskS2JFW3KISHb/o EVZxdxxPBB7VOEROYbHIE4wJsXavHzD/Z9/+n6qkWcPntfHcdKgrVLfDRkHmM7z3U4pO5Pssc3p xOm62tN6CQuYYsQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: E1221180005 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 5gc6hro51cqjwa96otnwm61dsgd3n99j X-HE-Tag: 1691437173-537224 X-HE-Meta: U2FsdGVkX199KaRf+Qz2LkondzAFveBqMNQaM+c64/AVU8FgYXgPzb/XWGT/q65C8HXaYQgQTFzb9UHntONEeRS3OePnZjBSxK1hWdNqUaEP1aysqtLdk5C76TLLdeZ/MSZZjlo7FSvCNzIjc16mbkvcfx+g2sXSkEyLdW7muyG9O5+rOsqzm6wbJf5gnKEjK8GbN9RAAaYGit+PsWqjrrDicRb+8otWjucLeNC1j92AaYK1MwzOuS5/rfbLVm2h908Anui9jWhQ1N2pbqVFyHp71zsDsO17KdcgoxAaemU4TdzkH09rvM6OfJANZIL4fKBI84i0rDKuLiPheJeRd9xRAkYUPGnJ+sbmgRSTWCnHpp+R0q5DsWxXm1RITQl7ZgQWak0Tw5DjILshsqK+KuFRryl4k0HfQdxhyNbfeUSn0cV0TX9uy9tvh0cbIbR7Q7QP02xMkQCEDY1M29T4O2AgKLQMeDiYfFsVpvz0zKlyMZTgfZYEQeO4OTP/aG6EhoJ361GJzNYkg/hdA/ExbhecqFoybc5hOkRJU1FResREyel791gD+TDLcQfiOUqxNj6Er26XlHRPc5+1MdoiHjeajjG4uXyJUcikFMHVBEq+XdUTo0mRV87/jdHADhRsEK7GGDe880mE+xJKxJHoGX+RFZnW79mD0NvX4iee0thcjMX3bDn40+y0kSRh56WhTFDdSzrp59QJq9PC891RUPlIsM3ULOh3SxBraLONd4uGeKDfPz/BW6qaRMvpqPU7B+jFj/60BhZtQVhOxA317ip5Ojh80u9aZdgqqniW+ARTNXh3uLNpULhnNtNjE745BR7WvBDTswzQuroOeA5KP9mBOmVraJwlOK5SthWy/vyvo8hthJk+cQyilh59WliAEzcygCYdU+JVPRuNZ8uilHLmewWylIvgyytSfriZMV/rEXz9XksI9T5firnhW+dqHFGKhyA7LfZUiIosmiV Oii6OWU6 ub0HsqZrN1eJvbWCsv6k0ejqcmnQO/lDLhs+L+U8GX9CZj1H7nNJZbDgN/hhd9xG7f662BxchgKCOv+L0nchyR9vW+wzws4g6rG3EZGxz4jkY1XGOMLcas6jx9fdP94MLkLR968CCMflj715zK1u4aoeYzEyS3Ell/8bspD5Kn8xHMOtwE39jfsQ2hwixt4ZPMDElJqVN462dJVehNNR2+zUM0gcfj937VA59lgzy4NEtrbxFyLuHW76N13dzTnLpeJJsBytPx99EpeZt3R4zc5HQur/28uUuq8o/qe22+b+wZhFqIDwjSYfdRI9RW6/2zN6Q95yPauOMPi3GTchP+hLrMUh8iqcNaM909dwJoVfdHUn6ESa2U9E2vNvbH9Kwta7P2/yt/NItEpU= 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 drop the "now" parameter from the update_time operation. Prepare XFS for this by reworking how it fetches timestamps and sets them in the inode. Ensure that we update the ctime even if only S_MTIME is set. Signed-off-by: Jeff Layton Reviewed-by: Jan Kara Acked-by: Darrick J. Wong --- fs/xfs/xfs_iops.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 731f45391baa..72d18e7840f5 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -1037,6 +1037,7 @@ xfs_vn_update_time( int log_flags = XFS_ILOG_TIMESTAMP; struct xfs_trans *tp; int error; + struct timespec64 now = current_time(inode); trace_xfs_update_time(ip); @@ -1056,12 +1057,15 @@ xfs_vn_update_time( return error; xfs_ilock(ip, XFS_ILOCK_EXCL); - if (flags & S_CTIME) - inode_set_ctime_to_ts(inode, *now); + if (flags & (S_CTIME|S_MTIME)) + now = inode_set_ctime_current(inode); + else + now = current_time(inode); + if (flags & S_MTIME) - inode->i_mtime = *now; + inode->i_mtime = now; if (flags & S_ATIME) - inode->i_atime = *now; + inode->i_atime = now; xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); xfs_trans_log_inode(tp, ip, log_flags);