Przeglądaj źródła

nfs41: only state manager sets NFS4CLNT_SESSION_SETUP

Replace sync and async handlers setting of the NFS4CLNT_SESSION_SETUP bit with
setting NFS4CLNT_CHECK_LEASE, and let the state manager decide to reset the session.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Andy Adamson 15 lat temu
rodzic
commit
0b9e2d41f1
2 zmienionych plików z 6 dodań i 4 usunięć
  1. 3 3
      fs/nfs/nfs4proc.c
  2. 3 1
      fs/nfs/nfs4state.c

+ 3 - 3
fs/nfs/nfs4proc.c

@@ -270,7 +270,7 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode,
 		case -NFS4ERR_SEQ_MISORDERED:
 		case -NFS4ERR_SEQ_MISORDERED:
 			dprintk("%s ERROR: %d Reset session\n", __func__,
 			dprintk("%s ERROR: %d Reset session\n", __func__,
 				errorcode);
 				errorcode);
-			set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
+			nfs4_schedule_state_recovery(clp);
 			exception->retry = 1;
 			exception->retry = 1;
 			break;
 			break;
 #endif /* !defined(CONFIG_NFS_V4_1) */
 #endif /* !defined(CONFIG_NFS_V4_1) */
@@ -466,7 +466,7 @@ static int nfs41_setup_sequence(struct nfs4_session *session,
 	tbl = &session->fc_slot_table;
 	tbl = &session->fc_slot_table;
 
 
 	spin_lock(&tbl->slot_tbl_lock);
 	spin_lock(&tbl->slot_tbl_lock);
-	if (test_bit(NFS4CLNT_SESSION_RESET, &session->clp->cl_state)) {
+	if (test_bit(NFS4CLNT_SESSION_DRAINING, &session->clp->cl_state)) {
 		/*
 		/*
 		 * The state manager will wait until the slot table is empty.
 		 * The state manager will wait until the slot table is empty.
 		 * Schedule the reset thread
 		 * Schedule the reset thread
@@ -3368,7 +3368,7 @@ _nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
 		case -NFS4ERR_SEQ_MISORDERED:
 		case -NFS4ERR_SEQ_MISORDERED:
 			dprintk("%s ERROR %d, Reset session\n", __func__,
 			dprintk("%s ERROR %d, Reset session\n", __func__,
 				task->tk_status);
 				task->tk_status);
-			set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
+			nfs4_schedule_state_recovery(clp);
 			task->tk_status = 0;
 			task->tk_status = 0;
 			return -EAGAIN;
 			return -EAGAIN;
 #endif /* CONFIG_NFS_V4_1 */
 #endif /* CONFIG_NFS_V4_1 */

+ 3 - 1
fs/nfs/nfs4state.c

@@ -1094,6 +1094,8 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
 		case -NFS4ERR_SEQ_FALSE_RETRY:
 		case -NFS4ERR_SEQ_FALSE_RETRY:
 		case -NFS4ERR_SEQ_MISORDERED:
 		case -NFS4ERR_SEQ_MISORDERED:
 			set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
 			set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
+			/* Zero session reset errors */
+			return 0;
 	}
 	}
 	return error;
 	return error;
 }
 }
@@ -1191,7 +1193,6 @@ static int nfs4_reset_session(struct nfs_client *clp)
 		set_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
 		set_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
 		spin_unlock(&tbl->slot_tbl_lock);
 		spin_unlock(&tbl->slot_tbl_lock);
 		status = wait_for_completion_interruptible(&ses->complete);
 		status = wait_for_completion_interruptible(&ses->complete);
-		clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
 		if (status) /* -ERESTARTSYS */
 		if (status) /* -ERESTARTSYS */
 			goto out;
 			goto out;
 	} else {
 	} else {
@@ -1212,6 +1213,7 @@ static int nfs4_reset_session(struct nfs_client *clp)
 		/* fall through*/
 		/* fall through*/
 out:
 out:
 	/* Wake up the next rpc task even on error */
 	/* Wake up the next rpc task even on error */
+	clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
 	rpc_wake_up_next(&clp->cl_session->fc_slot_table.slot_tbl_waitq);
 	rpc_wake_up_next(&clp->cl_session->fc_slot_table.slot_tbl_waitq);
 	return status;
 	return status;
 }
 }