Commit 69064a27 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: use deleg changes to cleanup preprocess_stateid_op

Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 97b7e3b6
...@@ -3290,6 +3290,7 @@ __be32 ...@@ -3290,6 +3290,7 @@ __be32
nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
stateid_t *stateid, int flags, struct file **filpp) stateid_t *stateid, int flags, struct file **filpp)
{ {
struct nfs4_stid *s;
struct nfs4_ol_stateid *stp = NULL; struct nfs4_ol_stateid *stp = NULL;
struct nfs4_delegation *dp = NULL; struct nfs4_delegation *dp = NULL;
struct svc_fh *current_fh = &cstate->current_fh; struct svc_fh *current_fh = &cstate->current_fh;
...@@ -3314,13 +3315,14 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, ...@@ -3314,13 +3315,14 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
* but that we can't find, is expired: * but that we can't find, is expired:
*/ */
status = nfserr_expired; status = nfserr_expired;
if (is_delegation_stateid(stateid)) { s = find_stateid(stateid);
dp = find_deleg_stateid(stateid); if (!s)
if (!dp) goto out;
goto out; status = check_stateid_generation(stateid, &s->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 out; if (s->sc_type == NFS4_DELEG_STID) {
dp = delegstateid(s);
status = nfs4_check_delegmode(dp, flags); status = nfs4_check_delegmode(dp, flags);
if (status) if (status)
goto out; goto out;
...@@ -3330,19 +3332,13 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, ...@@ -3330,19 +3332,13 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
BUG_ON(!*filpp); BUG_ON(!*filpp);
} }
} else { /* open or lock stateid */ } else { /* open or lock stateid */
stp = find_ol_stateid(stateid); stp = openlockstateid(s);
if (!stp)
goto out;
status = nfserr_bad_stateid; status = nfserr_bad_stateid;
if (nfs4_check_fh(current_fh, stp)) if (nfs4_check_fh(current_fh, stp))
goto out; goto out;
if (stp->st_stateowner->so_is_open_owner if (stp->st_stateowner->so_is_open_owner
&& !openowner(stp->st_stateowner)->oo_confirmed) && !openowner(stp->st_stateowner)->oo_confirmed)
goto out; goto out;
status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid,
nfsd4_has_session(cstate));
if (status)
goto out;
status = nfs4_check_openmode(stp, flags); status = nfs4_check_openmode(stp, flags);
if (status) if (status)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment