aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index bc683ed477e..df5b4807daa 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1113,6 +1113,27 @@ static int nfs4_reclaim_lease(struct nfs_client *clp)
1113 return status; 1113 return status;
1114} 1114}
1115 1115
1116#ifdef CONFIG_NFS_V4_1
1117
1118static int nfs4_initialize_session(struct nfs_client *clp)
1119{
1120 int status;
1121
1122 status = nfs4_proc_create_session(clp, 0);
1123 if (!status) {
1124 nfs_mark_client_ready(clp, NFS_CS_READY);
1125 } else if (status == -NFS4ERR_STALE_CLIENTID) {
1126 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1127 set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state);
1128 } else {
1129 nfs_mark_client_ready(clp, status);
1130 }
1131 return status;
1132}
1133#else /* CONFIG_NFS_V4_1 */
1134static int nfs4_initialize_session(struct nfs_client *clp) { return 0; }
1135#endif /* CONFIG_NFS_V4_1 */
1136
1116static void nfs4_state_manager(struct nfs_client *clp) 1137static void nfs4_state_manager(struct nfs_client *clp)
1117{ 1138{
1118 int status = 0; 1139 int status = 0;
@@ -1126,6 +1147,9 @@ static void nfs4_state_manager(struct nfs_client *clp)
1126 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); 1147 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1127 if (status == -EAGAIN) 1148 if (status == -EAGAIN)
1128 continue; 1149 continue;
1150 if (clp->cl_cons_state ==
1151 NFS_CS_SESSION_INITING)
1152 nfs_mark_client_ready(clp, status);
1129 goto out_error; 1153 goto out_error;
1130 } 1154 }
1131 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); 1155 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
@@ -1136,7 +1160,16 @@ static void nfs4_state_manager(struct nfs_client *clp)
1136 if (status != 0) 1160 if (status != 0)
1137 continue; 1161 continue;
1138 } 1162 }
1139 1163 /* Setup the session */
1164 if (nfs4_has_session(clp) &&
1165 test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) {
1166 status = nfs4_initialize_session(clp);
1167 if (status) {
1168 if (status == -NFS4ERR_STALE_CLIENTID)
1169 continue;
1170 goto out_error;
1171 }
1172 }
1140 /* First recover reboot state... */ 1173 /* First recover reboot state... */
1141 if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { 1174 if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
1142 status = nfs4_do_reclaim(clp, &nfs4_reboot_recovery_ops); 1175 status = nfs4_do_reclaim(clp, &nfs4_reboot_recovery_ops);