aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4callback.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2010-06-14 19:01:57 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-10-21 10:11:51 -0400
commitac7c46f29a44f6d7f6d2e36dc874c0b7056acad2 (patch)
tree8349c56fbb67cb456fea62fee6ef29df20d6f87b /fs/nfsd/nfs4callback.c
parent90c8145bb6fe1d9e0a808de6a701748967588bbd (diff)
nfsd4: make backchannel sequence number per-session
Currently we don't deal well with a client that has multiple sessions associated with it (even simultaneously, or serially over the lifetime of the client). In particular, we don't attempt to keep the backchannel running after the original session diseappears. We will fix that soon. Once we do that, we need the slot sequence number to be per-session; otherwise, for example, we cannot correctly handle a case like this: - All session 1 connections are lost. - The client creates session 2. We use it for the backchannel (since it's the only working choice). - The client gives us a new connection to use with session 1. - The client destroys session 2. At this point our only choice is to go back to using session 1. When we do so we must use the sequence number that is next for session 1. We therefore need to maintain multiple sequence number streams. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4callback.c')
-rw-r--r--fs/nfsd/nfs4callback.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 78ac779c09ff..5df9dda47bf4 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -260,7 +260,7 @@ encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_callback *cb,
260 260
261 WRITE32(OP_CB_SEQUENCE); 261 WRITE32(OP_CB_SEQUENCE);
262 WRITEMEM(ses->se_sessionid.data, NFS4_MAX_SESSIONID_LEN); 262 WRITEMEM(ses->se_sessionid.data, NFS4_MAX_SESSIONID_LEN);
263 WRITE32(cb->cb_clp->cl_cb_seq_nr); 263 WRITE32(ses->se_cb_seq_nr);
264 WRITE32(0); /* slotid, always 0 */ 264 WRITE32(0); /* slotid, always 0 */
265 WRITE32(0); /* highest slotid always 0 */ 265 WRITE32(0); /* highest slotid always 0 */
266 WRITE32(0); /* cachethis always 0 */ 266 WRITE32(0); /* cachethis always 0 */
@@ -369,7 +369,7 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_callback *cb,
369 goto out; 369 goto out;
370 } 370 }
371 READ32(dummy); 371 READ32(dummy);
372 if (dummy != cb->cb_clp->cl_cb_seq_nr) { 372 if (dummy != ses->se_cb_seq_nr) {
373 dprintk("%s Invalid sequence number\n", __func__); 373 dprintk("%s Invalid sequence number\n", __func__);
374 goto out; 374 goto out;
375 } 375 }
@@ -643,11 +643,11 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
643 643
644 if (clp->cl_cb_conn.cb_minorversion) { 644 if (clp->cl_cb_conn.cb_minorversion) {
645 /* No need for lock, access serialized in nfsd4_cb_prepare */ 645 /* No need for lock, access serialized in nfsd4_cb_prepare */
646 ++clp->cl_cb_seq_nr; 646 ++clp->cl_cb_session->se_cb_seq_nr;
647 clear_bit(0, &clp->cl_cb_slot_busy); 647 clear_bit(0, &clp->cl_cb_slot_busy);
648 rpc_wake_up_next(&clp->cl_cb_waitq); 648 rpc_wake_up_next(&clp->cl_cb_waitq);
649 dprintk("%s: freed slot, new seqid=%d\n", __func__, 649 dprintk("%s: freed slot, new seqid=%d\n", __func__,
650 clp->cl_cb_seq_nr); 650 clp->cl_cb_session->se_cb_seq_nr);
651 651
652 /* We're done looking into the sequence information */ 652 /* We're done looking into the sequence information */
653 task->tk_msg.rpc_resp = NULL; 653 task->tk_msg.rpc_resp = NULL;