[PATCH v3 0/8] nfsd: more delegated timestamp fixes

From: Jeff Layton

Date: Mon Nov 09 2026 - 15:40:35 EST


This version fixes the existing patches and adds some new ones to fix
problems that agentic review spotted. Note that there is also a
companion client-side series that fixes some related issues.

The catch with this version is that we need a fix to
inode_set_ctime_deleg(), and that lives in fs/inode.c. We'll either need
to get Christian to take that one or get his blessing to merge it via
the nfsd tree. It's a pretty small patch, so the latter might be OK.

Original cover letter follows:

Chuck recently added a new DELEG27 pynfs test that fails against nfsd.
These patches fix the behavior of delegated timestamps (again), such
that DELEG27 now passes.

I also ran some tests with the git regression testsuite which turns out
to be very sensitive to timestamp bugs, and that turned up a few more
server-side bugs.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
Changes in v3:
- "Honor delegated timestamps when change and size match":
- record applied times from SETATTR too, so a stale CB_GETATTR reply
can't move them backward
- record ctime from the inode; atime/mtime from the untruncated values
- move the vet/record prototypes to nfs4ctl.h
- "don't stamp over an applied delegated mtime at DELEGRETURN":
- share the vetting between SETATTR and CB_GETATTR
- set dl_setattr only after the holder's mtime is applied
- test dl_setattr under inode_lock at DELEGRETURN
- "don't vet delegated times against an exclusive-create verifier":
also set the floors for read timestamp delegations
- "mark the delegation written on COPY/CLONE instead of stamping c/mtime":
- look up the nfs4_file for every async COPY
- remove the now-unused nfsd_update_cmtime_attr()
- New: fs: check a fine-grained time before clamping a delegated ctime
- New: nfsd: check a fine-grained time before clamping a delegated mtime
- New: nfsd: raise delegated time floors after a size-changing SETATTR
- Kernel-doc, comment and commit message fixes
- Link to v2: https://lore.kernel.org/r/20261106-deleg-cb-getattr-times-v2-0-8433618ab9a1@xxxxxxxxxx

Changes in v2:
- "Honor delegated timestamps when change and size match" reworked:
- set ATTR_FORCE when applying the holder's times
- record applied times in dl_[amc]time; vet and record under inode_lock
- vet SETATTR's delegated times in nfsd_setattr() under inode_lock
- also mark file modified on a holder WRITE whose mtime didn't pass dl_mtime
- always report ncf_initial_cinfo as the change attr for timestamp delegations
- catch the holder's own server-side changes (SETATTR, xattrs, etc.)
via a change attribute saved at grant
- log, rather than fail the GETATTR, if applying the holder's times fails
- New: don't stamp over an applied delegated mtime at DELEGRETURN
- New: don't vet delegated times against an exclusive-create verifier
- New: mark the delegation written on COPY/CLONE instead of stamping c/mtime
- Link to v1: https://lore.kernel.org/r/20261102-deleg-cb-getattr-times-v1-0-ca0326d88623@xxxxxxxxxx

---
Jeff Layton (8):
nfsd: Report vetted delegated timestamps in GETATTR replies
nfsd: Honor delegated timestamps when change and size match
nfsd: don't stamp over an applied delegated mtime at DELEGRETURN
nfsd: don't vet delegated times against an exclusive-create verifier
nfsd: mark the delegation written on COPY/CLONE instead of stamping c/mtime
fs: check a fine-grained time before clamping a delegated ctime
nfsd: check a fine-grained time before clamping a delegated mtime
nfsd: raise delegated time floors after a size-changing SETATTR

fs/inode.c | 16 ++-
fs/nfsd/nfs4callback.c | 2 +-
fs/nfsd/nfs4ctl.h | 15 +++
fs/nfsd/nfs4proc.c | 101 +++++++++--------
fs/nfsd/nfs4state.c | 292 +++++++++++++++++++++++++++++++++++++------------
fs/nfsd/nfs4xdr.c | 10 +-
fs/nfsd/state.h | 6 +-
fs/nfsd/vfs.c | 6 +
fs/nfsd/vfs.h | 4 +
fs/nfsd/xdr4.h | 9 +-
10 files changed, 325 insertions(+), 136 deletions(-)
---
base-commit: d692f252c52b8d1b4bc7481554f314df31ed8249
change-id: 20261102-deleg-cb-getattr-times-8aa926029b16

Best regards,
--
Jeff Layton <jlayton@xxxxxxxxxx>