]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
nfsd: Migrate the stateid reference into nfs4_find_stateid_by_type()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 30 Jul 2014 01:34:25 +0000 (21:34 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 31 Jul 2014 18:20:17 +0000 (14:20 -0400)
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: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index a4a49a3b464c7e3776e04af824e7406f628944eb..653de6b14665a55d7208f5fefdb5431d56da5e82 100644 (file)
@@ -1696,8 +1696,12 @@ find_stateid_by_type(struct nfs4_client *cl, stateid_t *t, char typemask)
 
        spin_lock(&cl->cl_lock);
        s = find_stateid_locked(cl, t);
-       if (s != NULL && !(typemask & s->sc_type))
-               s = NULL;
+       if (s != NULL) {
+               if (typemask & s->sc_type)
+                       atomic_inc(&s->sc_count);
+               else
+                       s = NULL;
+       }
        spin_unlock(&cl->cl_lock);
        return s;
 }
@@ -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);
        if (!ret)
                return NULL;
-       /* FIXME: move into find_stateid_by_type */
-       atomic_inc(&ret->sc_count);
        return delegstateid(ret);
 }
 
@@ -4170,8 +4172,6 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
        *s = find_stateid_by_type(cstate->clp, stateid, typemask);
        if (!*s)
                return nfserr_bad_stateid;
-       /* FIXME: move into find_stateid_by_type */
-       atomic_inc(&(*s)->sc_count);
        return nfs_ok;
 }