Commit 684e5638 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: cleanup lock clientid handling in sessions case

I'd rather the "ignore clientid in sessions case" rule be enforced in
just one place.
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent b93d87c1
...@@ -3946,10 +3946,15 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -3946,10 +3946,15 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
* lock stateid. * lock stateid.
*/ */
struct nfs4_ol_stateid *open_stp = NULL; struct nfs4_ol_stateid *open_stp = NULL;
if (nfsd4_has_session(cstate))
/* See rfc 5661 18.10.3: given clientid is ignored: */
memcpy(&lock->v.new.clientid,
&cstate->session->se_client->cl_clientid,
sizeof(clientid_t));
status = nfserr_stale_clientid; status = nfserr_stale_clientid;
if (!nfsd4_has_session(cstate) && if (STALE_CLIENTID(&lock->lk_new_clientid))
STALE_CLIENTID(&lock->lk_new_clientid))
goto out; goto out;
/* validate and update open stateid and open seqid */ /* validate and update open stateid and open seqid */
...@@ -3961,8 +3966,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -3961,8 +3966,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
goto out; goto out;
open_sop = openowner(open_stp->st_stateowner); open_sop = openowner(open_stp->st_stateowner);
status = nfserr_bad_stateid; status = nfserr_bad_stateid;
if (!nfsd4_has_session(cstate) && if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
&lock->v.new.clientid)) &lock->v.new.clientid))
goto out; goto out;
/* create lockowner and lock stateid */ /* create lockowner and lock stateid */
......
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