aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-11-04 17:08:10 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-11-07 21:10:47 -0500
commit684e563858018d27acb8f00e30c026215bbd0ffb (patch)
treea07a17cebde75e8400eace2c989bae7293f0468c /fs/nfsd/nfs4state.c
parentb93d87c19821ba7d3ee11557403d782e541071ad (diff)
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: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 5abced7a7408..9354ddebbee2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3946,10 +3946,15 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3946 * lock stateid. 3946 * lock stateid.
3947 */ 3947 */
3948 struct nfs4_ol_stateid *open_stp = NULL; 3948 struct nfs4_ol_stateid *open_stp = NULL;
3949 3949
3950 if (nfsd4_has_session(cstate))
3951 /* See rfc 5661 18.10.3: given clientid is ignored: */
3952 memcpy(&lock->v.new.clientid,
3953 &cstate->session->se_client->cl_clientid,
3954 sizeof(clientid_t));
3955
3950 status = nfserr_stale_clientid; 3956 status = nfserr_stale_clientid;
3951 if (!nfsd4_has_session(cstate) && 3957 if (STALE_CLIENTID(&lock->lk_new_clientid))
3952 STALE_CLIENTID(&lock->lk_new_clientid))
3953 goto out; 3958 goto out;
3954 3959
3955 /* validate and update open stateid and open seqid */ 3960 /* validate and update open stateid and open seqid */
@@ -3961,8 +3966,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3961 goto out; 3966 goto out;
3962 open_sop = openowner(open_stp->st_stateowner); 3967 open_sop = openowner(open_stp->st_stateowner);
3963 status = nfserr_bad_stateid; 3968 status = nfserr_bad_stateid;
3964 if (!nfsd4_has_session(cstate) && 3969 if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
3965 !same_clid(&open_sop->oo_owner.so_client->cl_clientid,
3966 &lock->v.new.clientid)) 3970 &lock->v.new.clientid))
3967 goto out; 3971 goto out;
3968 /* create lockowner and lock stateid */ 3972 /* create lockowner and lock stateid */