From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Christian Brauner <brauner@kernel.org>
Cc: "Aurélien Couderc" <aurelien.couderc2002@gmail.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
"Jeff Layton" <jlayton@kernel.org>
Subject: [PATCH v3 12/12] nfsd: move ctime when CB_GETATTR applies a delegated mtime
Date: Tue, 24 Nov 2026 14:48:51 -0500 [thread overview]
Message-ID: <20261124-delegts-fixes-v3-12-6fe4ba705aef@kernel.org> (raw)
In-Reply-To: <20261124-delegts-fixes-v3-0-6fe4ba705aef@kernel.org>
cb_getattr_update_times() sets ATTR_CTIME only when the delegated ctime
passes vetting. When the vetted mtime is applied but the ctime is
rejected, the inode's mtime changes and its ctime doesn't.
Always set ATTR_CTIME with an applied mtime, and ATTR_CTIME_SET only
when the ctime passes vetting, so a rejected ctime moves to the current
time. This matches SETATTR with delegated times.
Fixes: b40b1ba37ad5 ("nfsd: fix timestamp updates in CB_GETATTR")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/nfs4state.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6bb3ce974c9c..9ebee4fca9d6 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -10910,10 +10910,11 @@ static int cb_getattr_update_times(struct dentry *dentry, struct nfs4_delegation
attrs.ia_valid |= ATTR_ATIME | ATTR_ATIME_SET;
if (nfsd4_vet_deleg_time(&attrs.ia_mtime, &dp->dl_mtime, &now)) {
- attrs.ia_valid |= ATTR_MTIME | ATTR_MTIME_SET;
+ /* A rejected ctime still moves, to the current time */
+ attrs.ia_valid |= ATTR_MTIME | ATTR_MTIME_SET | ATTR_CTIME;
attrs.ia_ctime = attrs.ia_mtime;
if (nfsd4_vet_deleg_time(&attrs.ia_ctime, &dp->dl_ctime, &now))
- attrs.ia_valid |= ATTR_CTIME | ATTR_CTIME_SET;
+ attrs.ia_valid |= ATTR_CTIME_SET;
}
} else {
attrs.ia_valid |= ATTR_MTIME | ATTR_CTIME;
--
2.56.1
next prev parent reply other threads:[~2026-11-24 19:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 19:48 [PATCH v3 00/12] nfsd: various delegated timestamp fixes Jeff Layton
2026-11-24 19:48 ` [PATCH v3 01/12] nfsd: don't hold inode_lock while waiting for a delegation in nfsd_setattr() Jeff Layton
2026-11-24 19:48 ` [PATCH v3 02/12] nfsd: take freeze protection before updating delegation timestamps Jeff Layton
2026-11-24 19:48 ` [PATCH v3 03/12] nfsd: count a delegation in cl_delegs_in_recall only once Jeff Layton
2026-11-24 19:48 ` [PATCH v3 04/12] nfsd: don't grant write delegations to NFSv4.0 clients on CLAIM_PREVIOUS Jeff Layton
2026-11-24 19:48 ` [PATCH v3 05/12] nfsd: set ctime when a SETATTR with delegated times changes other attributes Jeff Layton
2026-11-24 19:48 ` [PATCH v3 06/12] nfsd: pin the client while a GETATTR holds a conflicting delegation Jeff Layton
2026-11-24 19:48 ` [PATCH v3 07/12] nfsd: recall when a CB_GETATTR reply omits the size Jeff Layton
2026-11-24 19:48 ` [PATCH v3 08/12] nfsd: apply delegated times in a separate times-only setattr Jeff Layton
2026-11-24 19:48 ` [PATCH v3 09/12] nfsd: grant a plain read delegation when timestamps are wanted on a read open Jeff Layton
2026-11-24 19:48 ` [PATCH v3 10/12] nfsd: check fi_had_conflict under deleg_lock before hashing a delegation Jeff Layton
2026-11-24 19:48 ` [PATCH v3 11/12] nfsd: take the write delegation grant stat before hashing Jeff Layton
2026-11-24 19:48 ` Jeff Layton [this message]
2026-11-24 20:13 ` [PATCH v3 00/12] nfsd: various delegated timestamp fixes Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124-delegts-fixes-v3-12-6fe4ba705aef@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=aurelien.couderc2002@gmail.com \
--cc=brauner@kernel.org \
--cc=cel@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®