NFSD: Modernize nfsd4_release_lockowner()
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@oracle.com>
This commit is contained in:
Родитель
ce3c4ad7f4
Коммит
bd8fdb6e54
|
@ -7530,16 +7530,13 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
|
||||||
union nfsd4_op_u *u)
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
struct nfsd4_release_lockowner *rlockowner = &u->release_lockowner;
|
struct nfsd4_release_lockowner *rlockowner = &u->release_lockowner;
|
||||||
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 nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
|
||||||
|
clientid_t *clid = &rlockowner->rl_clientid;
|
||||||
|
struct nfs4_ol_stateid *stp;
|
||||||
|
struct nfs4_lockowner *lo;
|
||||||
struct nfs4_client *clp;
|
struct nfs4_client *clp;
|
||||||
LIST_HEAD (reaplist);
|
LIST_HEAD(reaplist);
|
||||||
|
__be32 status;
|
||||||
|
|
||||||
dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
|
dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
|
||||||
clid->cl_boot, clid->cl_id);
|
clid->cl_boot, clid->cl_id);
|
||||||
|
@ -7547,30 +7544,19 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
|
||||||
status = set_client(clid, cstate, nn);
|
status = set_client(clid, cstate, nn);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
clp = cstate->clp;
|
clp = cstate->clp;
|
||||||
/* Find the matching lock stateowner */
|
|
||||||
spin_lock(&clp->cl_lock);
|
spin_lock(&clp->cl_lock);
|
||||||
list_for_each_entry(sop, &clp->cl_ownerstr_hashtbl[hashval],
|
lo = find_lockowner_str_locked(clp, &rlockowner->rl_owner);
|
||||||
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;
|
|
||||||
}
|
|
||||||
if (!lo) {
|
if (!lo) {
|
||||||
spin_unlock(&clp->cl_lock);
|
spin_unlock(&clp->cl_lock);
|
||||||
return status;
|
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);
|
unhash_lockowner_locked(lo);
|
||||||
while (!list_empty(&lo->lo_owner.so_stateids)) {
|
while (!list_empty(&lo->lo_owner.so_stateids)) {
|
||||||
stp = list_first_entry(&lo->lo_owner.so_stateids,
|
stp = list_first_entry(&lo->lo_owner.so_stateids,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче