fs/nfsd/nfs4state.c | 5 ----- 1 file changed, 5 deletions(-)
op_delegate_type is assigned OPEN_DELEGATE_NONE just before the if-block
where condition specifies it not be equal to OPEN_DELEGATE_NONE. Compiler
treats the block as unreachable and optimizes it out from the resulting
executable.
In that aspect commit d08d32e6e5c0 ("nfsd4: return delegation immediately
if lease fails") notably makes no difference.
Seems it's better to just drop this code instead of fiddling with memory
barriers or atomics.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Matvey Kovalev <matvey.kovalev@ispras.ru>
---
fs/nfsd/nfs4state.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 88c347957da5b..debc6c8fef956 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -6284,11 +6284,6 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
return;
out_no_deleg:
open->op_delegate_type = OPEN_DELEGATE_NONE;
- if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS &&
- open->op_delegate_type != OPEN_DELEGATE_NONE) {
- dprintk("NFSD: WARNING: refusing delegation reclaim\n");
- open->op_recall = true;
- }
/* 4.1 client asking for a delegation? */
if (open->op_deleg_want)
--
2.43.0.windows.1
From: Chuck Lever <chuck.lever@oracle.com> On Mon, 29 Sep 2025 20:35:20 +0300, Matvey Kovalev wrote: > op_delegate_type is assigned OPEN_DELEGATE_NONE just before the if-block > where condition specifies it not be equal to OPEN_DELEGATE_NONE. Compiler > treats the block as unreachable and optimizes it out from the resulting > executable. > > In that aspect commit d08d32e6e5c0 ("nfsd4: return delegation immediately > if lease fails") notably makes no difference. > > [...] Applied to nfsd-testing, thanks! [1/1] nfsd: delete unreachable confusing code in nfs4_open_delegation() commit: c4a007c2d1fd7d96fbc3bd4fb45fbbc748d41789 -- Chuck Lever
On Mon, 2025-09-29 at 20:35 +0300, Matvey Kovalev wrote: > op_delegate_type is assigned OPEN_DELEGATE_NONE just before the if-block > where condition specifies it not be equal to OPEN_DELEGATE_NONE. Compiler > treats the block as unreachable and optimizes it out from the resulting > executable. > > In that aspect commit d08d32e6e5c0 ("nfsd4: return delegation immediately > if lease fails") notably makes no difference. > > Seems it's better to just drop this code instead of fiddling with memory > barriers or atomics. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Signed-off-by: Matvey Kovalev <matvey.kovalev@ispras.ru> > --- > fs/nfsd/nfs4state.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index 88c347957da5b..debc6c8fef956 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -6284,11 +6284,6 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open, > return; > out_no_deleg: > open->op_delegate_type = OPEN_DELEGATE_NONE; > - if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS && > - open->op_delegate_type != OPEN_DELEGATE_NONE) { > - dprintk("NFSD: WARNING: refusing delegation reclaim\n"); > - open->op_recall = true; > - } > > /* 4.1 client asking for a delegation? */ > if (open->op_deleg_want) Well spotted! Reviewed-by: Jeff Layton <jlayton@kernel.org>
© 2016 - 2025 Red Hat, Inc.