Skip to content

Commit

Permalink
nfsd4: cleanup lock clientid handling in sessions case
Browse files Browse the repository at this point in the history
I'd rather the "ignore clientid in sessions case" rule be enforced in
just one place.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
J. Bruce Fields committed Nov 8, 2011
1 parent b93d87c commit 684e563
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -3946,10 +3946,15 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
* lock stateid.
*/
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;
if (!nfsd4_has_session(cstate) &&
STALE_CLIENTID(&lock->lk_new_clientid))
if (STALE_CLIENTID(&lock->lk_new_clientid))
goto out;

/* validate and update open stateid and open seqid */
Expand All @@ -3961,8 +3966,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
goto out;
open_sop = openowner(open_stp->st_stateowner);
status = nfserr_bad_stateid;
if (!nfsd4_has_session(cstate) &&
!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
&lock->v.new.clientid))
goto out;
/* create lockowner and lock stateid */
Expand Down

0 comments on commit 684e563

Please sign in to comment.