diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-03-09 16:00:53 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-03-11 15:18:22 -0500 |
commit | 0400a6b0cb756f976bae32ae8db47bfa9853897c (patch) | |
tree | ec1393f7e5eeec02a0cc4504d98a138ae458f443 /fs/nfs/nfs4proc.c | |
parent | c34c32ea97718bb24fc06158733580003ba89211 (diff) |
NFSv4/4.1: Fix nfs4_schedule_state_recovery abuses
nfs4_schedule_state_recovery() should only be used when we need to force
the state manager to check the lease. If we just want to start the
state manager in order to handle a state recovery situation, we should be
using nfs4_schedule_state_manager().
This patch fixes the abuses of nfs4_schedule_state_recovery() by replacing
its use with a set of helper functions that do the right thing.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0a13ae720dd0..411dc80d0656 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -257,12 +257,13 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
257 | case -NFS4ERR_OPENMODE: | 257 | case -NFS4ERR_OPENMODE: |
258 | if (state == NULL) | 258 | if (state == NULL) |
259 | break; | 259 | break; |
260 | nfs4_state_mark_reclaim_nograce(clp, state); | 260 | nfs4_schedule_stateid_recovery(server, state); |
261 | goto do_state_recovery; | 261 | goto wait_on_recovery; |
262 | case -NFS4ERR_STALE_STATEID: | 262 | case -NFS4ERR_STALE_STATEID: |
263 | case -NFS4ERR_STALE_CLIENTID: | 263 | case -NFS4ERR_STALE_CLIENTID: |
264 | case -NFS4ERR_EXPIRED: | 264 | case -NFS4ERR_EXPIRED: |
265 | goto do_state_recovery; | 265 | nfs4_schedule_lease_recovery(clp); |
266 | goto wait_on_recovery; | ||
266 | #if defined(CONFIG_NFS_V4_1) | 267 | #if defined(CONFIG_NFS_V4_1) |
267 | case -NFS4ERR_BADSESSION: | 268 | case -NFS4ERR_BADSESSION: |
268 | case -NFS4ERR_BADSLOT: | 269 | case -NFS4ERR_BADSLOT: |
@@ -273,7 +274,7 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
273 | case -NFS4ERR_SEQ_MISORDERED: | 274 | case -NFS4ERR_SEQ_MISORDERED: |
274 | dprintk("%s ERROR: %d Reset session\n", __func__, | 275 | dprintk("%s ERROR: %d Reset session\n", __func__, |
275 | errorcode); | 276 | errorcode); |
276 | nfs4_schedule_state_recovery(clp); | 277 | nfs4_schedule_session_recovery(clp->cl_session); |
277 | exception->retry = 1; | 278 | exception->retry = 1; |
278 | break; | 279 | break; |
279 | #endif /* defined(CONFIG_NFS_V4_1) */ | 280 | #endif /* defined(CONFIG_NFS_V4_1) */ |
@@ -296,8 +297,7 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
296 | } | 297 | } |
297 | /* We failed to handle the error */ | 298 | /* We failed to handle the error */ |
298 | return nfs4_map_errors(ret); | 299 | return nfs4_map_errors(ret); |
299 | do_state_recovery: | 300 | wait_on_recovery: |
300 | nfs4_schedule_state_recovery(clp); | ||
301 | ret = nfs4_wait_clnt_recover(clp); | 301 | ret = nfs4_wait_clnt_recover(clp); |
302 | if (ret == 0) | 302 | if (ret == 0) |
303 | exception->retry = 1; | 303 | exception->retry = 1; |
@@ -1256,14 +1256,13 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state | |||
1256 | case -NFS4ERR_BAD_HIGH_SLOT: | 1256 | case -NFS4ERR_BAD_HIGH_SLOT: |
1257 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 1257 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
1258 | case -NFS4ERR_DEADSESSION: | 1258 | case -NFS4ERR_DEADSESSION: |
1259 | nfs4_schedule_state_recovery( | 1259 | nfs4_schedule_session_recovery(server->nfs_client->cl_session); |
1260 | server->nfs_client); | ||
1261 | goto out; | 1260 | goto out; |
1262 | case -NFS4ERR_STALE_CLIENTID: | 1261 | case -NFS4ERR_STALE_CLIENTID: |
1263 | case -NFS4ERR_STALE_STATEID: | 1262 | case -NFS4ERR_STALE_STATEID: |
1264 | case -NFS4ERR_EXPIRED: | 1263 | case -NFS4ERR_EXPIRED: |
1265 | /* Don't recall a delegation if it was lost */ | 1264 | /* Don't recall a delegation if it was lost */ |
1266 | nfs4_schedule_state_recovery(server->nfs_client); | 1265 | nfs4_schedule_lease_recovery(server->nfs_client); |
1267 | goto out; | 1266 | goto out; |
1268 | case -ERESTARTSYS: | 1267 | case -ERESTARTSYS: |
1269 | /* | 1268 | /* |
@@ -1272,7 +1271,7 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state | |||
1272 | */ | 1271 | */ |
1273 | case -NFS4ERR_ADMIN_REVOKED: | 1272 | case -NFS4ERR_ADMIN_REVOKED: |
1274 | case -NFS4ERR_BAD_STATEID: | 1273 | case -NFS4ERR_BAD_STATEID: |
1275 | nfs4_state_mark_reclaim_nograce(server->nfs_client, state); | 1274 | nfs4_schedule_stateid_recovery(server, state); |
1276 | case -EKEYEXPIRED: | 1275 | case -EKEYEXPIRED: |
1277 | /* | 1276 | /* |
1278 | * User RPCSEC_GSS context has expired. | 1277 | * User RPCSEC_GSS context has expired. |
@@ -1588,7 +1587,7 @@ static int nfs4_recover_expired_lease(struct nfs_server *server) | |||
1588 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && | 1587 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && |
1589 | !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) | 1588 | !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) |
1590 | break; | 1589 | break; |
1591 | nfs4_schedule_state_recovery(clp); | 1590 | nfs4_schedule_state_manager(clp); |
1592 | ret = -EIO; | 1591 | ret = -EIO; |
1593 | } | 1592 | } |
1594 | return ret; | 1593 | return ret; |
@@ -3179,7 +3178,7 @@ static void nfs4_renew_done(struct rpc_task *task, void *calldata) | |||
3179 | if (task->tk_status < 0) { | 3178 | if (task->tk_status < 0) { |
3180 | /* Unless we're shutting down, schedule state recovery! */ | 3179 | /* Unless we're shutting down, schedule state recovery! */ |
3181 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) != 0) | 3180 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) != 0) |
3182 | nfs4_schedule_state_recovery(clp); | 3181 | nfs4_schedule_lease_recovery(clp); |
3183 | return; | 3182 | return; |
3184 | } | 3183 | } |
3185 | do_renew_lease(clp, timestamp); | 3184 | do_renew_lease(clp, timestamp); |
@@ -3504,12 +3503,13 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3504 | case -NFS4ERR_OPENMODE: | 3503 | case -NFS4ERR_OPENMODE: |
3505 | if (state == NULL) | 3504 | if (state == NULL) |
3506 | break; | 3505 | break; |
3507 | nfs4_state_mark_reclaim_nograce(clp, state); | 3506 | nfs4_schedule_stateid_recovery(server, state); |
3508 | goto do_state_recovery; | 3507 | goto wait_on_recovery; |
3509 | case -NFS4ERR_STALE_STATEID: | 3508 | case -NFS4ERR_STALE_STATEID: |
3510 | case -NFS4ERR_STALE_CLIENTID: | 3509 | case -NFS4ERR_STALE_CLIENTID: |
3511 | case -NFS4ERR_EXPIRED: | 3510 | case -NFS4ERR_EXPIRED: |
3512 | goto do_state_recovery; | 3511 | nfs4_schedule_lease_recovery(clp); |
3512 | goto wait_on_recovery; | ||
3513 | #if defined(CONFIG_NFS_V4_1) | 3513 | #if defined(CONFIG_NFS_V4_1) |
3514 | case -NFS4ERR_BADSESSION: | 3514 | case -NFS4ERR_BADSESSION: |
3515 | case -NFS4ERR_BADSLOT: | 3515 | case -NFS4ERR_BADSLOT: |
@@ -3520,7 +3520,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3520 | case -NFS4ERR_SEQ_MISORDERED: | 3520 | case -NFS4ERR_SEQ_MISORDERED: |
3521 | dprintk("%s ERROR %d, Reset session\n", __func__, | 3521 | dprintk("%s ERROR %d, Reset session\n", __func__, |
3522 | task->tk_status); | 3522 | task->tk_status); |
3523 | nfs4_schedule_state_recovery(clp); | 3523 | nfs4_schedule_session_recovery(clp->cl_session); |
3524 | task->tk_status = 0; | 3524 | task->tk_status = 0; |
3525 | return -EAGAIN; | 3525 | return -EAGAIN; |
3526 | #endif /* CONFIG_NFS_V4_1 */ | 3526 | #endif /* CONFIG_NFS_V4_1 */ |
@@ -3537,9 +3537,8 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3537 | } | 3537 | } |
3538 | task->tk_status = nfs4_map_errors(task->tk_status); | 3538 | task->tk_status = nfs4_map_errors(task->tk_status); |
3539 | return 0; | 3539 | return 0; |
3540 | do_state_recovery: | 3540 | wait_on_recovery: |
3541 | rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL); | 3541 | rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL); |
3542 | nfs4_schedule_state_recovery(clp); | ||
3543 | if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0) | 3542 | if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0) |
3544 | rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task); | 3543 | rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task); |
3545 | task->tk_status = 0; | 3544 | task->tk_status = 0; |
@@ -4406,12 +4405,14 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | |||
4406 | case -NFS4ERR_EXPIRED: | 4405 | case -NFS4ERR_EXPIRED: |
4407 | case -NFS4ERR_STALE_CLIENTID: | 4406 | case -NFS4ERR_STALE_CLIENTID: |
4408 | case -NFS4ERR_STALE_STATEID: | 4407 | case -NFS4ERR_STALE_STATEID: |
4408 | nfs4_schedule_lease_recovery(server->nfs_client); | ||
4409 | goto out; | ||
4409 | case -NFS4ERR_BADSESSION: | 4410 | case -NFS4ERR_BADSESSION: |
4410 | case -NFS4ERR_BADSLOT: | 4411 | case -NFS4ERR_BADSLOT: |
4411 | case -NFS4ERR_BAD_HIGH_SLOT: | 4412 | case -NFS4ERR_BAD_HIGH_SLOT: |
4412 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 4413 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
4413 | case -NFS4ERR_DEADSESSION: | 4414 | case -NFS4ERR_DEADSESSION: |
4414 | nfs4_schedule_state_recovery(server->nfs_client); | 4415 | nfs4_schedule_session_recovery(server->nfs_client->cl_session); |
4415 | goto out; | 4416 | goto out; |
4416 | case -ERESTARTSYS: | 4417 | case -ERESTARTSYS: |
4417 | /* | 4418 | /* |
@@ -4421,7 +4422,7 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | |||
4421 | case -NFS4ERR_ADMIN_REVOKED: | 4422 | case -NFS4ERR_ADMIN_REVOKED: |
4422 | case -NFS4ERR_BAD_STATEID: | 4423 | case -NFS4ERR_BAD_STATEID: |
4423 | case -NFS4ERR_OPENMODE: | 4424 | case -NFS4ERR_OPENMODE: |
4424 | nfs4_state_mark_reclaim_nograce(server->nfs_client, state); | 4425 | nfs4_schedule_stateid_recovery(server, state); |
4425 | err = 0; | 4426 | err = 0; |
4426 | goto out; | 4427 | goto out; |
4427 | case -EKEYEXPIRED: | 4428 | case -EKEYEXPIRED: |
@@ -5150,7 +5151,7 @@ static int nfs41_sequence_handle_errors(struct rpc_task *task, struct nfs_client | |||
5150 | rpc_delay(task, NFS4_POLL_RETRY_MAX); | 5151 | rpc_delay(task, NFS4_POLL_RETRY_MAX); |
5151 | return -EAGAIN; | 5152 | return -EAGAIN; |
5152 | default: | 5153 | default: |
5153 | nfs4_schedule_state_recovery(clp); | 5154 | nfs4_schedule_lease_recovery(clp); |
5154 | } | 5155 | } |
5155 | return 0; | 5156 | return 0; |
5156 | } | 5157 | } |
@@ -5291,7 +5292,7 @@ static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nf | |||
5291 | rpc_delay(task, NFS4_POLL_RETRY_MAX); | 5292 | rpc_delay(task, NFS4_POLL_RETRY_MAX); |
5292 | return -EAGAIN; | 5293 | return -EAGAIN; |
5293 | default: | 5294 | default: |
5294 | nfs4_schedule_state_recovery(clp); | 5295 | nfs4_schedule_lease_recovery(clp); |
5295 | } | 5296 | } |
5296 | return 0; | 5297 | return 0; |
5297 | } | 5298 | } |