aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2010-04-21 12:27:19 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2010-04-22 11:35:14 -0400
commit5771635592267758e7dc5647f2a0088aa6244159 (patch)
tree71ffa3a85fe311d5eef591ba69e0bbe7d0b17edc /fs/nfsd/nfs4state.c
parent4b21d0defcc9680da8a694e92d5fe8eb668c2c0b (diff)
nfsd4: complete enforcement of 4.1 op ordering
Enforce the rules about compound op ordering. Motivated by implementing RECLAIM_COMPLETE, for which the client is implicit in the current session, so it is important to ensure a succesful SEQUENCE proceeds the RECLAIM_COMPLETE. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 4300d9ffe95f..bba9fff49cfe 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1343,6 +1343,14 @@ out:
1343 return status; 1343 return status;
1344} 1344}
1345 1345
1346static bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
1347{
1348 struct nfsd4_compoundres *resp = rqstp->rq_resp;
1349 struct nfsd4_compoundargs *argp = rqstp->rq_argp;
1350
1351 return argp->opcnt == resp->opcnt;
1352}
1353
1346__be32 1354__be32
1347nfsd4_destroy_session(struct svc_rqst *r, 1355nfsd4_destroy_session(struct svc_rqst *r,
1348 struct nfsd4_compound_state *cstate, 1356 struct nfsd4_compound_state *cstate,
@@ -1358,6 +1366,11 @@ nfsd4_destroy_session(struct svc_rqst *r,
1358 * - Do we need to clear any callback info from previous session? 1366 * - Do we need to clear any callback info from previous session?
1359 */ 1367 */
1360 1368
1369 if (!memcmp(&sessionid->sessionid, &cstate->session->se_sessionid,
1370 sizeof(struct nfs4_sessionid))) {
1371 if (!nfsd4_last_compound_op(r))
1372 return nfserr_not_only_op;
1373 }
1361 dump_sessionid(__func__, &sessionid->sessionid); 1374 dump_sessionid(__func__, &sessionid->sessionid);
1362 spin_lock(&sessionid_lock); 1375 spin_lock(&sessionid_lock);
1363 ses = find_in_sessionid_hashtbl(&sessionid->sessionid); 1376 ses = find_in_sessionid_hashtbl(&sessionid->sessionid);