nfsd: find_cpntf_state cleanup
[ Upstream commit 47fdb22dacae78f37701d82a94c16a014186d34e ] I think this unusual use of struct compound_state could cause confusion. It's not that much more complicated just to open-code this stateid lookup. The only change in behavior should be a different error return in the case the copy is using a source stateid that is a revoked delegation, but I doubt that matters. Signed-off-by: J. Bruce Fields <bfields@redhat.com> [ cel: squashed in fix reported by Coverity ] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
794841da84
commit
30a20ecc1b
1 changed files with 14 additions and 8 deletions
|
@ -5832,21 +5832,27 @@ static __be32 find_cpntf_state(struct nfsd_net *nn, stateid_t *st,
|
|||
{
|
||||
__be32 status;
|
||||
struct nfs4_cpntf_state *cps = NULL;
|
||||
struct nfsd4_compound_state cstate;
|
||||
struct nfs4_client *found;
|
||||
|
||||
status = manage_cpntf_state(nn, st, NULL, &cps);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
cps->cpntf_time = ktime_get_boottime_seconds();
|
||||
memset(&cstate, 0, sizeof(cstate));
|
||||
status = set_client(&cps->cp_p_clid, &cstate, nn, true);
|
||||
if (status)
|
||||
|
||||
status = nfserr_expired;
|
||||
found = lookup_clientid(&cps->cp_p_clid, true, nn);
|
||||
if (!found)
|
||||
goto out;
|
||||
status = nfsd4_lookup_stateid(&cstate, &cps->cp_p_stateid,
|
||||
NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID,
|
||||
stid, nn);
|
||||
put_client_renew(cstate.clp);
|
||||
|
||||
*stid = find_stateid_by_type(found, &cps->cp_p_stateid,
|
||||
NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID);
|
||||
if (*stid)
|
||||
status = nfs_ok;
|
||||
else
|
||||
status = nfserr_bad_stateid;
|
||||
|
||||
put_client_renew(found);
|
||||
out:
|
||||
nfs4_put_cpntf_state(nn, cps);
|
||||
return status;
|
||||
|
|
Loading…
Reference in a new issue