From mboxrd@z Thu Jan 1 00:00:00 1970 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 AB668C77B6F for ; Tue, 11 Apr 2023 15:15:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4CA46900005; Tue, 11 Apr 2023 11:15:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47A50900002; Tue, 11 Apr 2023 11:15:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 341C3900005; Tue, 11 Apr 2023 11:15:28 -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 231A3900002 for ; Tue, 11 Apr 2023 11:15:28 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E917C80680 for ; Tue, 11 Apr 2023 15:15:27 +0000 (UTC) X-FDA: 80669459094.07.EFD92E0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id DF472A002F for ; Tue, 11 Apr 2023 15:15:25 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=O0hExX+i; spf=pass (imf25.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@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=1681226126; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TWa6ejtlwXZO02I6u/iilgGEHS3t0qzXx12yaO8Pd+8=; b=IjZyKYQkBbVhgNEhOmflenzzMfXAbd2ieczljDIYLDaL7SW/JVZwxfpwWcCXsOWzw8hYWn 8J1VOCOK6RZIpJwqZ10v2h5T0pYUnAhXvDTL/9cXDhV7FaCCCNDavbCUxHBaaSuIk5unbH Y4DMDPX1EdtvYdzUNZEc7satzd6vE/w= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=O0hExX+i; spf=pass (imf25.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681226126; a=rsa-sha256; cv=none; b=oUa6zGnbwStXdu4Qyzl0u3J0NZX050VG1agIK5uu2QM7Ui32Kf0AcRohe1XpAb6GU0fvvE 7rz9ybiQiSNFUJbzK1XNVAk50qd09G0ujywK/PWXLlP8STXgZtZsx5Rzx6KU5TGc2pnVVD bnvnJoCtCyYxtg68rVh9S6xuODN0v3A= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4CD862850; Tue, 11 Apr 2023 15:15:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65855C433D2; Tue, 11 Apr 2023 15:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681226124; bh=kRbdgrXjLG5GyyTrGV82AnFP0qt1dfRAJUPj3Z2Dpg0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O0hExX+iuTqWf56efMiKBf61MZJGoDdlaLysDm8q4AO9oaXzSZsBEtS58Z9PjvN5V +YBrx26G5BwtJSPnbjXm38d5X6N3cpU0dse51LLkdvBHPJTDx9e9+t1qVDaHtc1/vM DvnejoQm+RVzZwERNT/nODPoYtR/vKKoXwwZWOkaQ6CpZgrNmaJsnA24N5aDjGEvzp mqFGNDXOEGb9QqEBqOCQu4HGJVS9fv34lsz07HD6I8OrDiEOxG6mQ+1ul6PKBygvqP v1wg5F1KQ4zyu2TBXi58pceLgCqsxGwgHA/y5ad7qrFCHnbOA4gv/DzgavKraTIjC6 iObWhxjBsDn6g== Date: Tue, 11 Apr 2023 17:15:17 +0200 From: Christian Brauner To: "Darrick J. Wong" Cc: Jeff Layton , Alexander Viro , Hugh Dickins , Andrew Morton , Dave Chinner , Chuck Lever , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Subject: Re: [RFC PATCH 3/3][RESEND] xfs: mark the inode for high-res timestamp update in getattr Message-ID: <20230411-schokolade-hegemonie-83b1f0ecfd6c@brauner> References: <20230411143702.64495-1-jlayton@kernel.org> <20230411143702.64495-4-jlayton@kernel.org> <20230411145446.GG360895@frogsfrogsfrogs> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230411145446.GG360895@frogsfrogsfrogs> X-Stat-Signature: pomqxsar38e7eanuefmip4nwxgj6gg3i X-Rspam-User: X-Rspamd-Queue-Id: DF472A002F X-Rspamd-Server: rspam06 X-HE-Tag: 1681226125-287665 X-HE-Meta: U2FsdGVkX1+Jb0YRJrY6zVT6d8Z/J0Y+w1rzK9YtdDH6WyZnKxEraWjHJzoCnu2Z/Xbo+EHOqTYRm381tTqwhcFmM5nHageeVuoSRcEzOln/jGHUbHjN+go9jjZ5DbOvG8u6hT/hOO/+qdNouIftofvBlUhMXLOqRo6i9kxm61cCt/Hluvm2fW9cCKdrYc1zoKX0MJY+hdqDHEWHvXzfh5sfnBN/SB+4drTzTlyMg0t54G98wMBRYJYhUl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waa8JbXgH4DWOvaDOdAfvDS1WrfopkLKYjifQ1cSm1+yZlKLFmhMqVg== 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: On Tue, Apr 11, 2023 at 07:54:46AM -0700, Darrick J. Wong wrote: > On Tue, Apr 11, 2023 at 10:37:02AM -0400, Jeff Layton wrote: > > When the mtime or ctime is being queried via getattr, ensure that we > > mark the inode for a high-res timestamp update on the next pass. Also, > > switch to current_cmtime for other c/mtime updates. > > > > With this change, we're better off having the NFS server just ignore > > the i_version field and have it use the ctime instead, so clear the > > STATX_CHANGE_COOKIE flag in the result mask in ->getattr. > > > > Signed-off-by: Jeff Layton > > --- > > fs/xfs/libxfs/xfs_trans_inode.c | 2 +- > > fs/xfs/xfs_acl.c | 2 +- > > fs/xfs/xfs_inode.c | 2 +- > > fs/xfs/xfs_iops.c | 15 ++++++++++++--- > > 4 files changed, 15 insertions(+), 6 deletions(-) > > > > diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c > > index 8b5547073379..9ad7c229c617 100644 > > --- a/fs/xfs/libxfs/xfs_trans_inode.c > > +++ b/fs/xfs/libxfs/xfs_trans_inode.c > > @@ -63,7 +63,7 @@ xfs_trans_ichgtime( > > ASSERT(tp); > > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); > > > > - tv = current_time(inode); > > + tv = current_cmtime(inode); > > > > if (flags & XFS_ICHGTIME_MOD) > > inode->i_mtime = tv; > > diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c > > index 791db7d9c849..461adc58cf8c 100644 > > --- a/fs/xfs/xfs_acl.c > > +++ b/fs/xfs/xfs_acl.c > > @@ -233,7 +233,7 @@ xfs_acl_set_mode( > > xfs_ilock(ip, XFS_ILOCK_EXCL); > > xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); > > inode->i_mode = mode; > > - inode->i_ctime = current_time(inode); > > + inode->i_ctime = current_cmtime(inode); > > Hmm, now we're adding a spinlock to all these updates. > Does lockdep have anything exciting to say about this? > > (I don't think it will, just wondering aloud...) > > > xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); > > > > if (xfs_has_wsync(mp)) > > diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c > > index 5808abab786c..80f9d731e261 100644 > > --- a/fs/xfs/xfs_inode.c > > +++ b/fs/xfs/xfs_inode.c > > @@ -843,7 +843,7 @@ xfs_init_new_inode( > > ip->i_df.if_nextents = 0; > > ASSERT(ip->i_nblocks == 0); > > > > - tv = current_time(inode); > > + tv = current_cmtime(inode); > > inode->i_mtime = tv; > > inode->i_atime = tv; > > inode->i_ctime = tv; > > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > > index 24718adb3c16..a0b07f90e16c 100644 > > --- a/fs/xfs/xfs_iops.c > > +++ b/fs/xfs/xfs_iops.c > > @@ -565,6 +565,15 @@ xfs_vn_getattr( > > if (xfs_is_shutdown(mp)) > > return -EIO; > > > > + /* > > + * XFS uses the i_version infrastructure to track any change to > > + * the inode, including atime updates. This means that the i_version > > + * returned by getattr doesn't conform to what the callers expect. > > + * Clear it here so that nfsd will fake up a change cookie from the > > + * ctime instead. > > + */ > > + stat->result_mask &= ~STATX_CHANGE_COOKIE; > > + > > stat->size = XFS_ISIZE(ip); > > stat->dev = inode->i_sb->s_dev; > > stat->mode = inode->i_mode; > > @@ -573,8 +582,8 @@ 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->i_ctime; > > + if (request_mask & (STATX_CTIME|STATX_MTIME)) > > + fill_cmtime_and_mark(inode, stat); > > Should we be setting STATX_[CM]TIME in the result_mask, just in case the > caller asked for ctime and not mtime? I think the expectation is that everything in STATX_BASIC_MASK is always returned to allow equivalence between stat() and statx(). So requesting STATX_CTIME separately from STATX_MTIME isn't implemented widely, maybe even not at atll?, yet.