aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-12-03 15:53:22 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-12-03 15:53:22 -0500
commitb6d408ba8c8be3646dea6f80a2fe55ac403119c8 (patch)
treef3305d34863a99c7df4c1453f860237845a21923 /fs/nfs/nfs4state.c
parenta9ed2e2583747fb3139a764c317fac58893b968f (diff)
NFSv4: Fix up error handling in the state manager main loop.
The nfs4_state_manager should not be looking at the error values when deciding whether or not to loop round in order to handle a higher priority state recovery task. It should rather be looking at the clp->cl_state. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index b53e37fb0302..62927879572f 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1046,11 +1046,6 @@ static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp)
1046 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce); 1046 nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce);
1047} 1047}
1048 1048
1049static void nfs4_state_end_reclaim_nograce(struct nfs_client *clp)
1050{
1051 clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
1052}
1053
1054static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) 1049static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
1055{ 1050{
1056 switch (error) { 1051 switch (error) {
@@ -1237,7 +1232,8 @@ static void nfs4_state_manager(struct nfs_client *clp)
1237 status = nfs4_reclaim_lease(clp); 1232 status = nfs4_reclaim_lease(clp);
1238 if (status) { 1233 if (status) {
1239 nfs4_set_lease_expired(clp, status); 1234 nfs4_set_lease_expired(clp, status);
1240 if (status == -EAGAIN) 1235 if (test_bit(NFS4CLNT_LEASE_EXPIRED,
1236 &clp->cl_state))
1241 continue; 1237 continue;
1242 if (clp->cl_cons_state == 1238 if (clp->cl_cons_state ==
1243 NFS_CS_SESSION_INITING) 1239 NFS_CS_SESSION_INITING)
@@ -1249,9 +1245,12 @@ static void nfs4_state_manager(struct nfs_client *clp)
1249 1245
1250 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { 1246 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
1251 status = nfs4_check_lease(clp); 1247 status = nfs4_check_lease(clp);
1252 if (status != 0) 1248 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
1253 continue; 1249 continue;
1250 if (status < 0 && status != -NFS4ERR_CB_PATH_DOWN)
1251 goto out_error;
1254 } 1252 }
1253
1255 /* Initialize or reset the session */ 1254 /* Initialize or reset the session */
1256 if (test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state) 1255 if (test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)
1257 && nfs4_has_session(clp)) { 1256 && nfs4_has_session(clp)) {
@@ -1259,41 +1258,36 @@ static void nfs4_state_manager(struct nfs_client *clp)
1259 status = nfs4_initialize_session(clp); 1258 status = nfs4_initialize_session(clp);
1260 else 1259 else
1261 status = nfs4_reset_session(clp); 1260 status = nfs4_reset_session(clp);
1262 if (status) { 1261 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
1263 if (status == -NFS4ERR_STALE_CLIENTID) 1262 continue;
1264 continue; 1263 if (status < 0)
1265 goto out_error; 1264 goto out_error;
1266 }
1267 } 1265 }
1266
1268 /* First recover reboot state... */ 1267 /* First recover reboot state... */
1269 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { 1268 if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
1270 status = nfs4_do_reclaim(clp, 1269 status = nfs4_do_reclaim(clp,
1271 nfs4_reboot_recovery_ops[clp->cl_minorversion]); 1270 nfs4_reboot_recovery_ops[clp->cl_minorversion]);
1272 if (status == -NFS4ERR_STALE_CLIENTID) 1271 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
1273 continue; 1272 test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state))
1274 if (test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state))
1275 continue; 1273 continue;
1276 nfs4_state_end_reclaim_reboot(clp); 1274 nfs4_state_end_reclaim_reboot(clp);
1277 continue; 1275 if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state))
1276 continue;
1277 if (status < 0)
1278 goto out_error;
1278 } 1279 }
1279 1280
1280 /* Now recover expired state... */ 1281 /* Now recover expired state... */
1281 if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { 1282 if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) {
1282 status = nfs4_do_reclaim(clp, 1283 status = nfs4_do_reclaim(clp,
1283 nfs4_nograce_recovery_ops[clp->cl_minorversion]); 1284 nfs4_nograce_recovery_ops[clp->cl_minorversion]);
1284 if (status < 0) { 1285 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
1285 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); 1286 test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state) ||
1286 if (status == -NFS4ERR_STALE_CLIENTID) 1287 test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
1287 continue; 1288 continue;
1288 if (status == -NFS4ERR_EXPIRED) 1289 if (status < 0)
1289 continue;
1290 if (test_bit(NFS4CLNT_SESSION_SETUP,
1291 &clp->cl_state))
1292 continue;
1293 goto out_error; 1290 goto out_error;
1294 } else
1295 nfs4_state_end_reclaim_nograce(clp);
1296 continue;
1297 } 1291 }
1298 1292
1299 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) { 1293 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {