[PATCH v3 04/12] nfsd: don't grant write delegations to NFSv4.0 clients on CLAIM_PREVIOUS
From: Jeff Layton
Date: Tue Nov 24 2026 - 14:49:36 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 NFSD can never complete a
GETATTR that the client sends before DELEGRETURN in the same compound.
Apply the same check to CLAIM_PREVIOUS.
Fixes: 1d3dd1d56ce8 ("NFSD: Enable write delegation support")
Reviewed-by: Aurélien Couderc <aurelien.couderc2002@xxxxxxxxx>
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 c2c082006d81..f865548c297b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -7542,6 +7542,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 == 0)
+ goto out_no_deleg;
if (!cb_up)
open->op_recall = true;
break;
--
2.56.1