[PATCH 09/11] nfsd: grant a plain read delegation when timestamps are wanted on a read open
From: Jeff Layton
Date: Fri Nov 20 2026 - 11:41:09 EST
A read open that wants delegated timestamps gets
OPEN_DELEGATE_READ_ATTRS_DELEG. Several clients can hold read
delegations at once, so delegating atime correctly would need exclusive
authority over it, or merging the times of every read holder. Neither
is implemented.
Grant OPEN_DELEGATE_READ instead. The want flag is a request, so
declining the attribute delegation complies with RFC 9754 section 5.
The XDR cases for the type stay, since the enum is on the wire.
Fixes: 6ae30d6eb26b ("nfsd: add support for delegated timestamps")
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
fs/nfsd/nfs4state.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index eead615aac0a..fc01ff50c8b2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -7328,10 +7328,14 @@ nfs4_set_delegation(struct nfsd4_open *open,
* A read delegation can go to a client that holds a write open
* of the file: nfsd_breaker_owns_lease() keeps the holder's own
* opens from breaking it.
+ *
+ * Never OPEN_DELEGATE_READ_ATTRS_DELEG: delegating atime correctly
+ * would need exclusive authority over it, or merging the times of
+ * several read holders. The want flag is only a request.
*/
if (!nf && (open->op_share_access & NFS4_SHARE_ACCESS_READ)) {
nf = find_readable_file(fp);
- dl_type = deleg_ts ? OPEN_DELEGATE_READ_ATTRS_DELEG : OPEN_DELEGATE_READ;
+ dl_type = OPEN_DELEGATE_READ;
}
if (!nf)
@@ -7629,9 +7633,7 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
spin_unlock(&f->f_lock);
trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid);
} else {
- open->op_delegate_type = deleg_ts && nfs4_delegation_stat(dp, currentfh, &stat) ?
- OPEN_DELEGATE_READ_ATTRS_DELEG : OPEN_DELEGATE_READ;
- dp->dl_atime = stat.atime;
+ open->op_delegate_type = OPEN_DELEGATE_READ;
trace_nfsd_deleg_read(&dp->dl_stid.sc_stateid);
}
nfs4_put_stid(&dp->dl_stid);
--
2.56.1