浏览代码

NFSv4.1: Ensure we clear session state flags after a session creation

Both nfs4_reset_session and nfs41_init_clientid need to clear all the
session related state flags on success.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Trond Myklebust 13 年之前
父节点
当前提交
bda197f5d7
共有 1 个文件被更改,包括 12 次插入10 次删除
  1. 12 10
      fs/nfs/nfs4state.c

+ 12 - 10
fs/nfs/nfs4state.c

@@ -244,6 +244,16 @@ static int nfs4_begin_drain_session(struct nfs_client *clp)
 	return nfs4_wait_on_slot_tbl(&ses->fc_slot_table);
 	return nfs4_wait_on_slot_tbl(&ses->fc_slot_table);
 }
 }
 
 
+static void nfs41_finish_session_reset(struct nfs_client *clp)
+{
+	clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
+	clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
+	/* create_session negotiated new slot table */
+	clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
+	clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
+	nfs41_setup_state_renewal(clp);
+}
+
 int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
 int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
 {
 {
 	int status;
 	int status;
@@ -259,8 +269,7 @@ do_confirm:
 	status = nfs4_proc_create_session(clp, cred);
 	status = nfs4_proc_create_session(clp, cred);
 	if (status != 0)
 	if (status != 0)
 		goto out;
 		goto out;
-	clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
-	nfs41_setup_state_renewal(clp);
+	nfs41_finish_session_reset(clp);
 	nfs_mark_client_ready(clp, NFS_CS_READY);
 	nfs_mark_client_ready(clp, NFS_CS_READY);
 out:
 out:
 	return status;
 	return status;
@@ -1772,16 +1781,9 @@ static int nfs4_reset_session(struct nfs_client *clp)
 		status = nfs4_handle_reclaim_lease_error(clp, status);
 		status = nfs4_handle_reclaim_lease_error(clp, status);
 		goto out;
 		goto out;
 	}
 	}
-	clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
-	/* create_session negotiated new slot table */
-	clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
-	clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
+	nfs41_finish_session_reset(clp);
 	dprintk("%s: session reset was successful for server %s!\n",
 	dprintk("%s: session reset was successful for server %s!\n",
 			__func__, clp->cl_hostname);
 			__func__, clp->cl_hostname);
-
-	 /* Let the state manager reestablish state */
-	if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
-		nfs41_setup_state_renewal(clp);
 out:
 out:
 	if (cred)
 	if (cred)
 		put_rpccred(cred);
 		put_rpccred(cred);