Re: [PATCH 04/11] nfsd: don't grant write delegations to NFSv4.0 clients on CLAIM_PREVIOUS

From: Aurélien Couderc

Date: Mon Nov 23 2026 - 04:57:27 EST


On Fri, Nov 20, 2026 at 6:00 PM Jeff Layton <jlayton@xxxxxxxxxx> wrote:
>
> 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)

The ! operator should only be used for boolean operations. Please use
an explicit (clp->cl_minorversion == 0) to make the intention clear.


Aurélien
--
Aurélien Couderc <aurelien.couderc2002@xxxxxxxxx>
Big Data/Data mining expert, chess enthusiast