[PATCH v3 12/12] nfsd: move ctime when CB_GETATTR applies a delegated mtime
From: Jeff Layton
Date: Tue Nov 24 2026 - 14:49:44 EST
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@xxxxxxxxxx>
---
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