[PATCH 04/11] nfsd: don't grant write delegations to NFSv4.0 clients on CLAIM_PREVIOUS
From: Jeff Layton
Date: Fri Nov 20 2026 - 11:40:53 EST
nfs4_open_delegation() refuses delegations for NFSv4.0 write opens on
CLAIM_NULL and CLAIM_FH, as its comment explains, but CLAIM_PREVIOUS
skips the check. An NFSv4.0 client reclaiming a write open during grace
can therefore get a write delegation, and a GETATTR it sends before
DELEGRETURN in the same compound can never be answered.
Apply the same check to CLAIM_PREVIOUS.
Fixes: 1d3dd1d56ce8 ("NFSD: Enable write delegation support")
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
fs/nfsd/nfs4state.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 490fefaef52a..64bf2e96dc7b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -7532,6 +7532,9 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
open->op_recall = false;
switch (open->op_claim_type) {
case NFS4_OPEN_CLAIM_PREVIOUS:
+ if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE &&
+ !clp->cl_minorversion)
+ goto out_no_deleg;
if (!cb_up)
open->op_recall = true;
break;
--
2.56.1