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

From: Aurélien Couderc

Date: Tue Nov 24 2026 - 02:40:44 EST


On Mon, Nov 23, 2026 at 1:59 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 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")
> 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 5c2151b329c4..4b28553efc8d 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -7533,6 +7533,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).

Thank you.

You can add a Reviewed-By: Aurélien Couderc
<aurelien.couderc2002@xxxxxxxxx>, please

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