Commit 858cc573 authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields

nfsd: nfsd4_locku() must reference the lock stateid

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: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 3d0fabd5
...@@ -5147,10 +5147,12 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -5147,10 +5147,12 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
&stp, nn); &stp, nn);
if (status) if (status)
goto out; 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); filp = find_any_file(stp->st_stid.sc_file);
if (!filp) { if (!filp) {
status = nfserr_lock_range; status = nfserr_lock_range;
goto out; goto put_stateid;
} }
file_lock = locks_alloc_lock(); file_lock = locks_alloc_lock();
if (!file_lock) { if (!file_lock) {
...@@ -5180,6 +5182,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -5180,6 +5182,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
memcpy(&locku->lu_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); memcpy(&locku->lu_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
fput: fput:
fput(filp); fput(filp);
put_stateid:
nfs4_put_stid(&stp->st_stid);
out: out:
nfsd4_bump_seqid(cstate, status); nfsd4_bump_seqid(cstate, status);
if (!cstate->replay_owner) if (!cstate->replay_owner)
......
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