diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-02-05 12:35:16 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-02-11 15:33:13 -0500 |
commit | 37380e4264dbda9753e470a30d4322097aab7152 (patch) | |
tree | 2ec4ea71b702e0bb2718b54c8f7a0cf274605609 | |
parent | d25be546a86fcb2ea919fb909a42b79aa40b816c (diff) |
NFSv4: Fix up the return values of nfs4_open_delegation_recall
Adjust the return values so that they return EAGAIN to the caller in
cases where we might want to retry the delegation recall after
the state recovery has run.
Note that we can't wait and retry in this routine, because the caller
may be the state manager thread.
If delegation recall fails due to a session or reboot related issue,
also ensure that we mark the stateid as delegated so that
nfs_delegation_claim_opens can find it again later.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a1e89e270ad8..f7e05ade5572 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1355,19 +1355,18 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state | |||
1355 | case -NFS4ERR_BAD_HIGH_SLOT: | 1355 | case -NFS4ERR_BAD_HIGH_SLOT: |
1356 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 1356 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
1357 | case -NFS4ERR_DEADSESSION: | 1357 | case -NFS4ERR_DEADSESSION: |
1358 | set_bit(NFS_DELEGATED_STATE, &state->flags); | ||
1358 | nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); | 1359 | nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); |
1360 | err = -EAGAIN; | ||
1359 | goto out; | 1361 | goto out; |
1360 | case -NFS4ERR_STALE_CLIENTID: | 1362 | case -NFS4ERR_STALE_CLIENTID: |
1361 | case -NFS4ERR_STALE_STATEID: | 1363 | case -NFS4ERR_STALE_STATEID: |
1364 | set_bit(NFS_DELEGATED_STATE, &state->flags); | ||
1362 | case -NFS4ERR_EXPIRED: | 1365 | case -NFS4ERR_EXPIRED: |
1363 | /* Don't recall a delegation if it was lost */ | 1366 | /* Don't recall a delegation if it was lost */ |
1364 | nfs4_schedule_lease_recovery(server->nfs_client); | 1367 | nfs4_schedule_lease_recovery(server->nfs_client); |
1368 | err = -EAGAIN; | ||
1365 | goto out; | 1369 | goto out; |
1366 | case -ERESTARTSYS: | ||
1367 | /* | ||
1368 | * The show must go on: exit, but mark the | ||
1369 | * stateid as needing recovery. | ||
1370 | */ | ||
1371 | case -NFS4ERR_DELEG_REVOKED: | 1370 | case -NFS4ERR_DELEG_REVOKED: |
1372 | case -NFS4ERR_ADMIN_REVOKED: | 1371 | case -NFS4ERR_ADMIN_REVOKED: |
1373 | case -NFS4ERR_BAD_STATEID: | 1372 | case -NFS4ERR_BAD_STATEID: |
@@ -1378,6 +1377,7 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state | |||
1378 | err = 0; | 1377 | err = 0; |
1379 | goto out; | 1378 | goto out; |
1380 | } | 1379 | } |
1380 | set_bit(NFS_DELEGATED_STATE, &state->flags); | ||
1381 | err = nfs4_handle_exception(server, err, &exception); | 1381 | err = nfs4_handle_exception(server, err, &exception); |
1382 | } while (exception.retry); | 1382 | } while (exception.retry); |
1383 | out: | 1383 | out: |
@@ -4957,24 +4957,22 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | |||
4957 | case 0: | 4957 | case 0: |
4958 | case -ESTALE: | 4958 | case -ESTALE: |
4959 | goto out; | 4959 | goto out; |
4960 | case -NFS4ERR_EXPIRED: | ||
4961 | nfs4_schedule_stateid_recovery(server, state); | ||
4962 | case -NFS4ERR_STALE_CLIENTID: | 4960 | case -NFS4ERR_STALE_CLIENTID: |
4963 | case -NFS4ERR_STALE_STATEID: | 4961 | case -NFS4ERR_STALE_STATEID: |
4962 | set_bit(NFS_DELEGATED_STATE, &state->flags); | ||
4963 | case -NFS4ERR_EXPIRED: | ||
4964 | nfs4_schedule_lease_recovery(server->nfs_client); | 4964 | nfs4_schedule_lease_recovery(server->nfs_client); |
4965 | err = -EAGAIN; | ||
4965 | goto out; | 4966 | goto out; |
4966 | case -NFS4ERR_BADSESSION: | 4967 | case -NFS4ERR_BADSESSION: |
4967 | case -NFS4ERR_BADSLOT: | 4968 | case -NFS4ERR_BADSLOT: |
4968 | case -NFS4ERR_BAD_HIGH_SLOT: | 4969 | case -NFS4ERR_BAD_HIGH_SLOT: |
4969 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 4970 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
4970 | case -NFS4ERR_DEADSESSION: | 4971 | case -NFS4ERR_DEADSESSION: |
4972 | set_bit(NFS_DELEGATED_STATE, &state->flags); | ||
4971 | nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); | 4973 | nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); |
4974 | err = -EAGAIN; | ||
4972 | goto out; | 4975 | goto out; |
4973 | case -ERESTARTSYS: | ||
4974 | /* | ||
4975 | * The show must go on: exit, but mark the | ||
4976 | * stateid as needing recovery. | ||
4977 | */ | ||
4978 | case -NFS4ERR_DELEG_REVOKED: | 4976 | case -NFS4ERR_DELEG_REVOKED: |
4979 | case -NFS4ERR_ADMIN_REVOKED: | 4977 | case -NFS4ERR_ADMIN_REVOKED: |
4980 | case -NFS4ERR_BAD_STATEID: | 4978 | case -NFS4ERR_BAD_STATEID: |
@@ -4987,9 +4985,8 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | |||
4987 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | 4985 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ |
4988 | err = 0; | 4986 | err = 0; |
4989 | goto out; | 4987 | goto out; |
4990 | case -NFS4ERR_DELAY: | ||
4991 | break; | ||
4992 | } | 4988 | } |
4989 | set_bit(NFS_DELEGATED_STATE, &state->flags); | ||
4993 | err = nfs4_handle_exception(server, err, &exception); | 4990 | err = nfs4_handle_exception(server, err, &exception); |
4994 | } while (exception.retry); | 4991 | } while (exception.retry); |
4995 | out: | 4992 | out: |