Commit 2d3f9668 authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields

nfsd: Migrate the stateid reference into nfs4_find_stateid_by_type()

Allow nfs4_find_stateid_by_type to take the stateid reference, while
still holding the &cl->cl_lock. Necessary step toward client_mutex
removal.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent fd911011
...@@ -1696,8 +1696,12 @@ find_stateid_by_type(struct nfs4_client *cl, stateid_t *t, char typemask) ...@@ -1696,8 +1696,12 @@ find_stateid_by_type(struct nfs4_client *cl, stateid_t *t, char typemask)
spin_lock(&cl->cl_lock); spin_lock(&cl->cl_lock);
s = find_stateid_locked(cl, t); s = find_stateid_locked(cl, t);
if (s != NULL && !(typemask & s->sc_type)) if (s != NULL) {
s = NULL; if (typemask & s->sc_type)
atomic_inc(&s->sc_count);
else
s = NULL;
}
spin_unlock(&cl->cl_lock); spin_unlock(&cl->cl_lock);
return s; return s;
} }
...@@ -3326,8 +3330,6 @@ static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl, statei ...@@ -3326,8 +3330,6 @@ static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl, statei
ret = find_stateid_by_type(cl, s, NFS4_DELEG_STID); ret = find_stateid_by_type(cl, s, NFS4_DELEG_STID);
if (!ret) if (!ret)
return NULL; return NULL;
/* FIXME: move into find_stateid_by_type */
atomic_inc(&ret->sc_count);
return delegstateid(ret); return delegstateid(ret);
} }
...@@ -4170,8 +4172,6 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, ...@@ -4170,8 +4172,6 @@ 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;
} }
......
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