Skip to contentSkip to conversation

NFSD: fix setting FMODE_NOCMTIME in nfs4_open_delegation

PATCH In review Olga Kornievskaia 3 participants 3 messages Dec 19, 2025

Subsystems (2)
lore
Share & tools
lore

Olga Kornievskaia

author reviewer
#0 lore raw

PATCH 1/1 NFSD: fix setting FMODE_NOCMTIME in nfs4_open_delegation

fstests generic/215 and generic/407 were failing because the server wasn't updating mtime properly. When deleg attribute support is not compiled in and thus no attribute delegation was given, the server was skipping updating mtime and ctime because FMODE_NOCMTIME was uncoditionally set for the write delegation.

Fixes e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation")
---
 fs/nfsd/nfs4state.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c +2 -1
index 808c24fb5c9a..d64650c47f79 100644
@@ -6327,7 +6327,8 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
 		dp->dl_ctime = stat.ctime;
 		dp->dl_mtime = stat.mtime;
 		spin_lock(&f->f_lock);
-		f->f_mode |= FMODE_NOCMTIME;
+		if (deleg_ts)
+			f->f_mode |= FMODE_NOCMTIME;
 		spin_unlock(&f->f_lock);
 		trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid);
 	} else {
Signature · 1 line
2.47.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Olga Kornievskaia

fstests generic/215 and generic/407 were failing because the server wasn't updating mtime properly. When deleg attribute support is not compiled in and thus no attribute delegation was given, the server was skipping updating mtime and ctime because FMODE_NOCMTIME was uncoditionally set for the write delegation.

Fixes e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation")
---
 fs/nfsd/nfs4state.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c +0 -0
index 808c24fb5c9a..d64650c47f79 100644

fs/nfsd/nfs4state.c nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open, · line 6334

Quoted 9 lines
fs/nfsd/nfs4state.c +2 -1
@@ -6327,7 +6327,8 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
 		dp->dl_ctime = stat.ctime;
 		dp->dl_mtime = stat.mtime;
 		spin_lock(&f->f_lock);
-		f->f_mode |= FMODE_NOCMTIME;
+		if (deleg_ts)
+			f->f_mode |= FMODE_NOCMTIME;
 		spin_unlock(&f->f_lock);
 		trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid);
 	} else {

Nice catch.

We only want to disable c/mtime updates in the case where timestamps are delegated. In the non-delegated case, they need to be updated with every write. This seems correct to me.

maintainer
#2 lore raw
In reply to Olga Kornievskaia

From: Chuck Lever <[email protected]>

Quoted 8 lines · Olga Kornievskaia

fstests generic/215 and generic/407 were failing because the server wasn't updating mtime properly. When deleg attribute support is not compiled in and thus no attribute delegation was given, the server was skipping updating mtime and ctime because FMODE_NOCMTIME was uncoditionally set for the write delegation.

[...]

Applied to nfsd-testing, thanks!

[1/1] NFSD: fix setting FMODE_NOCMTIME in nfs4_open_delegation

      commit: ad8ac894d0d9797f557cbf51c05fd32830887d9c

--
Chuck Lever