Ensure that nfsd4_locku() keeps a reference to the lock stateid
until it is done working with it. Necessary step toward client_mutex
removal.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
                                        &stp, nn);
        if (status)
                goto out;
+       /* FIXME: move into nfs4_preprocess_seqid_op */
+       atomic_inc(&stp->st_stid.sc_count);
        filp = find_any_file(stp->st_stid.sc_file);
        if (!filp) {
                status = nfserr_lock_range;
-               goto out;
+               goto put_stateid;
        }
        file_lock = locks_alloc_lock();
        if (!file_lock) {
        memcpy(&locku->lu_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
 fput:
        fput(filp);
+put_stateid:
+       nfs4_put_stid(&stp->st_stid);
 out:
        nfsd4_bump_seqid(cstate, status);
        if (!cstate->replay_owner)