mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-22 22:04:47 +08:00
nfsd: Migrate the stateid reference into nfs4_lookup_stateid()
Allow nfs4_lookup_stateid to take the stateid reference, instead of having all the callers do so. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
4cbfc9f704
commit
fd9110113c
@ -4170,6 +4170,8 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
|
|||||||
*s = find_stateid_by_type(cstate->clp, stateid, typemask);
|
*s = find_stateid_by_type(cstate->clp, stateid, typemask);
|
||||||
if (!*s)
|
if (!*s)
|
||||||
return nfserr_bad_stateid;
|
return nfserr_bad_stateid;
|
||||||
|
/* FIXME: move into find_stateid_by_type */
|
||||||
|
atomic_inc(&(*s)->sc_count);
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4204,7 +4206,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
|
|||||||
NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID,
|
NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID,
|
||||||
&s, nn);
|
&s, nn);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto unlock_state;
|
||||||
status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate));
|
status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate));
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
@ -4253,6 +4255,8 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
|
|||||||
if (file)
|
if (file)
|
||||||
*filpp = file;
|
*filpp = file;
|
||||||
out:
|
out:
|
||||||
|
nfs4_put_stid(s);
|
||||||
|
unlock_state:
|
||||||
nfs4_unlock_state();
|
nfs4_unlock_state();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -4390,11 +4394,10 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
|
|||||||
cstate->replay_owner = stp->st_stateowner;
|
cstate->replay_owner = stp->st_stateowner;
|
||||||
|
|
||||||
status = nfs4_seqid_op_checks(cstate, stateid, seqid, stp);
|
status = nfs4_seqid_op_checks(cstate, stateid, seqid, stp);
|
||||||
if (!status) {
|
if (!status)
|
||||||
/* FIXME: move into find_stateid_by_type */
|
|
||||||
atomic_inc(&stp->st_stid.sc_count);
|
|
||||||
*stpp = stp;
|
*stpp = stp;
|
||||||
}
|
else
|
||||||
|
nfs4_put_stid(&stp->st_stid);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4623,9 +4626,11 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
dp = delegstateid(s);
|
dp = delegstateid(s);
|
||||||
status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate));
|
status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate));
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto put_stateid;
|
||||||
|
|
||||||
destroy_delegation(dp);
|
destroy_delegation(dp);
|
||||||
|
put_stateid:
|
||||||
|
nfs4_put_stid(&dp->dl_stid);
|
||||||
out:
|
out:
|
||||||
nfs4_unlock_state();
|
nfs4_unlock_state();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user