> On Mar 9, 2024, at 9:36 PM, Sasha Levin <sashal@xxxxxxxxxx> wrote: > > This is a note to let you know that I've just added the patch titled > > NFSD: Modernize nfsd4_release_lockowner() > > to the 5.10-stable tree which can be found at: > http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary > > The filename of the patch is: > nfsd-modernize-nfsd4_release_lockowner.patch > and it can be found in the queue-5.10 subdirectory. > > If you, or anyone else, feels it should not be added to the stable tree, > please let <stable@xxxxxxxxxxxxxxx> know about it. > > > > commit 73f6ed66fe4fc6f405e3d72225f9d5cc964c5265 > Author: Chuck Lever <chuck.lever@xxxxxxxxxx> > Date: Sun May 22 12:07:18 2022 -0400 > > NFSD: Modernize nfsd4_release_lockowner() > > [ Upstream commit bd8fdb6e545f950f4654a9a10d7e819ad48146e5 ] > > Refactor: Use existing helpers that other lock operations use. This > change removes several automatic variables, so re-organize the > variable declarations for readability. > > Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> > Stable-dep-of: edcf9725150e ("nfsd: fix RELEASE_LOCKOWNER") > Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index d402ca0b535f0..1b40b2197ce66 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -7113,16 +7113,13 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, > union nfsd4_op_u *u) > { > struct nfsd4_release_lockowner *rlockowner = &u->release_lockowner; > + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); > clientid_t *clid = &rlockowner->rl_clientid; > - struct nfs4_stateowner *sop; > - struct nfs4_lockowner *lo = NULL; > struct nfs4_ol_stateid *stp; > - struct xdr_netobj *owner = &rlockowner->rl_owner; > - unsigned int hashval = ownerstr_hashval(owner); > - __be32 status; > - struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); > + struct nfs4_lockowner *lo; > struct nfs4_client *clp; > - LIST_HEAD (reaplist); > + LIST_HEAD(reaplist); > + __be32 status; > > dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n", > clid->cl_boot, clid->cl_id); > @@ -7130,30 +7127,19 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, > status = lookup_clientid(clid, cstate, nn, false); > if (status) > return status; > - > clp = cstate->clp; > - /* Find the matching lock stateowner */ > - spin_lock(&clp->cl_lock); > - list_for_each_entry(sop, &clp->cl_ownerstr_hashtbl[hashval], > - so_strhash) { > > - if (sop->so_is_open_owner || !same_owner_str(sop, owner)) > - continue; > - > - if (atomic_read(&sop->so_count) != 1) { > - spin_unlock(&clp->cl_lock); > - return nfserr_locks_held; > - } > - > - lo = lockowner(sop); > - nfs4_get_stateowner(sop); > - break; > - } > + spin_lock(&clp->cl_lock); > + lo = find_lockowner_str_locked(clp, &rlockowner->rl_owner); > if (!lo) { > spin_unlock(&clp->cl_lock); > return status; > } > - > + if (atomic_read(&lo->lo_owner.so_count) != 2) { > + spin_unlock(&clp->cl_lock); > + nfs4_put_stateowner(&lo->lo_owner); > + return nfserr_locks_held; > + } > unhash_lockowner_locked(lo); > while (!list_empty(&lo->lo_owner.so_stateids)) { > stp = list_first_entry(&lo->lo_owner.so_stateids, Please do not take these into the v5.10.y kernel. I'm working on a patch bundle for v5.10.y that includes these patches. See the nfsd-5.10.y branch in https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git -- Chuck Lever