aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/nfs4proc.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ed6c8899806d..a2855391b079 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -423,6 +423,22 @@ out:
423 return ret_id; 423 return ret_id;
424} 424}
425 425
426static int nfs4_recover_session(struct nfs4_session *session)
427{
428 struct nfs_client *clp = session->clp;
429 int ret;
430
431 for (;;) {
432 ret = nfs4_wait_clnt_recover(clp);
433 if (ret != 0)
434 return ret;
435 if (!test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state))
436 break;
437 nfs4_schedule_state_manager(clp);
438 }
439 return 0;
440}
441
426static int nfs41_setup_sequence(struct nfs4_session *session, 442static int nfs41_setup_sequence(struct nfs4_session *session,
427 struct nfs4_sequence_args *args, 443 struct nfs4_sequence_args *args,
428 struct nfs4_sequence_res *res, 444 struct nfs4_sequence_res *res,
@@ -431,6 +447,7 @@ static int nfs41_setup_sequence(struct nfs4_session *session,
431{ 447{
432 struct nfs4_slot *slot; 448 struct nfs4_slot *slot;
433 struct nfs4_slot_table *tbl; 449 struct nfs4_slot_table *tbl;
450 int status = 0;
434 u8 slotid; 451 u8 slotid;
435 452
436 dprintk("--> %s\n", __func__); 453 dprintk("--> %s\n", __func__);
@@ -443,6 +460,23 @@ static int nfs41_setup_sequence(struct nfs4_session *session,
443 tbl = &session->fc_slot_table; 460 tbl = &session->fc_slot_table;
444 461
445 spin_lock(&tbl->slot_tbl_lock); 462 spin_lock(&tbl->slot_tbl_lock);
463 if (test_bit(NFS4CLNT_SESSION_SETUP, &session->clp->cl_state)) {
464 if (tbl->highest_used_slotid != -1) {
465 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
466 spin_unlock(&tbl->slot_tbl_lock);
467 dprintk("<-- %s: Session reset: draining\n", __func__);
468 return -EAGAIN;
469 }
470
471 /* The slot table is empty; start the reset thread */
472 dprintk("%s Session Reset\n", __func__);
473 spin_unlock(&tbl->slot_tbl_lock);
474 status = nfs4_recover_session(session);
475 if (status)
476 return status;
477 spin_lock(&tbl->slot_tbl_lock);
478 }
479
446 slotid = nfs4_find_slot(tbl, task); 480 slotid = nfs4_find_slot(tbl, task);
447 if (slotid == NFS4_MAX_SLOT_TABLE) { 481 if (slotid == NFS4_MAX_SLOT_TABLE) {
448 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL); 482 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);