aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-01-07 09:42:03 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-02-10 08:30:50 -0500
commit2c6434888cef9e5f450d6c5b7df6d8c625ed27c1 (patch)
treee27b7cbd25ec699c9c8c85f9405ef039e57c659a /fs
parentdc5ddce956660247e004a4b20a26b7d137ab1644 (diff)
nfs4: handle -EKEYEXPIRED errors from RPC layer
If a KRB5 TGT ticket expires, we don't want to return an error immediatel. If someone has a long running job and just forgets to run "kinit" in time then this will make it fail. Instead, we want to treat this situation as we would NFS4ERR_DELAY and retry the upcall after delaying a bit with an exponential backoff. This patch just makes any place that would handle NFS4ERR_DELAY also handle -EKEYEXPIRED the same way. In the future, we may want to be more sophisticated however and handle hard vs. soft mounts differently, or specify some upper limit on how long we'll wait for a new TGT to be acquired. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c11
-rw-r--r--fs/nfs/nfs4state.c1
2 files changed, 10 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 375f0fae2c6a..8d0c3a977c36 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -281,6 +281,7 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode,
281 } 281 }
282 case -NFS4ERR_GRACE: 282 case -NFS4ERR_GRACE:
283 case -NFS4ERR_DELAY: 283 case -NFS4ERR_DELAY:
284 case -EKEYEXPIRED:
284 ret = nfs4_delay(server->client, &exception->timeout); 285 ret = nfs4_delay(server->client, &exception->timeout);
285 if (ret != 0) 286 if (ret != 0)
286 break; 287 break;
@@ -1163,7 +1164,7 @@ static int nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
1163 int err; 1164 int err;
1164 do { 1165 do {
1165 err = _nfs4_do_open_reclaim(ctx, state); 1166 err = _nfs4_do_open_reclaim(ctx, state);
1166 if (err != -NFS4ERR_DELAY) 1167 if (err != -NFS4ERR_DELAY && err != -EKEYEXPIRED)
1167 break; 1168 break;
1168 nfs4_handle_exception(server, err, &exception); 1169 nfs4_handle_exception(server, err, &exception);
1169 } while (exception.retry); 1170 } while (exception.retry);
@@ -1582,6 +1583,7 @@ static int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4_state
1582 goto out; 1583 goto out;
1583 case -NFS4ERR_GRACE: 1584 case -NFS4ERR_GRACE:
1584 case -NFS4ERR_DELAY: 1585 case -NFS4ERR_DELAY:
1586 case -EKEYEXPIRED:
1585 nfs4_handle_exception(server, err, &exception); 1587 nfs4_handle_exception(server, err, &exception);
1586 err = 0; 1588 err = 0;
1587 } 1589 }
@@ -3452,6 +3454,7 @@ _nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
3452 if (server) 3454 if (server)
3453 nfs_inc_server_stats(server, NFSIOS_DELAY); 3455 nfs_inc_server_stats(server, NFSIOS_DELAY);
3454 case -NFS4ERR_GRACE: 3456 case -NFS4ERR_GRACE:
3457 case -EKEYEXPIRED:
3455 rpc_delay(task, NFS4_POLL_RETRY_MAX); 3458 rpc_delay(task, NFS4_POLL_RETRY_MAX);
3456 task->tk_status = 0; 3459 task->tk_status = 0;
3457 return -EAGAIN; 3460 return -EAGAIN;
@@ -3564,6 +3567,7 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp, struct rpc_cred *cred)
3564 case -NFS4ERR_RESOURCE: 3567 case -NFS4ERR_RESOURCE:
3565 /* The IBM lawyers misread another document! */ 3568 /* The IBM lawyers misread another document! */
3566 case -NFS4ERR_DELAY: 3569 case -NFS4ERR_DELAY:
3570 case -EKEYEXPIRED:
3567 err = nfs4_delay(clp->cl_rpcclient, &timeout); 3571 err = nfs4_delay(clp->cl_rpcclient, &timeout);
3568 } 3572 }
3569 } while (err == 0); 3573 } while (err == 0);
@@ -4179,7 +4183,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request
4179 if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) 4183 if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0)
4180 return 0; 4184 return 0;
4181 err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_RECLAIM); 4185 err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_RECLAIM);
4182 if (err != -NFS4ERR_DELAY) 4186 if (err != -NFS4ERR_DELAY && err != -EKEYEXPIRED)
4183 break; 4187 break;
4184 nfs4_handle_exception(server, err, &exception); 4188 nfs4_handle_exception(server, err, &exception);
4185 } while (exception.retry); 4189 } while (exception.retry);
@@ -4204,6 +4208,7 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request
4204 goto out; 4208 goto out;
4205 case -NFS4ERR_GRACE: 4209 case -NFS4ERR_GRACE:
4206 case -NFS4ERR_DELAY: 4210 case -NFS4ERR_DELAY:
4211 case -EKEYEXPIRED:
4207 nfs4_handle_exception(server, err, &exception); 4212 nfs4_handle_exception(server, err, &exception);
4208 err = 0; 4213 err = 0;
4209 } 4214 }
@@ -4355,6 +4360,7 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl)
4355 err = 0; 4360 err = 0;
4356 goto out; 4361 goto out;
4357 case -NFS4ERR_DELAY: 4362 case -NFS4ERR_DELAY:
4363 case -EKEYEXPIRED:
4358 break; 4364 break;
4359 } 4365 }
4360 err = nfs4_handle_exception(server, err, &exception); 4366 err = nfs4_handle_exception(server, err, &exception);
@@ -4554,6 +4560,7 @@ static void nfs4_get_lease_time_done(struct rpc_task *task, void *calldata)
4554 switch (task->tk_status) { 4560 switch (task->tk_status) {
4555 case -NFS4ERR_DELAY: 4561 case -NFS4ERR_DELAY:
4556 case -NFS4ERR_GRACE: 4562 case -NFS4ERR_GRACE:
4563 case -EKEYEXPIRED:
4557 dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status); 4564 dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status);
4558 rpc_delay(task, NFS4_POLL_RETRY_MIN); 4565 rpc_delay(task, NFS4_POLL_RETRY_MIN);
4559 task->tk_status = 0; 4566 task->tk_status = 0;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index c1e2733f4fa4..8406cacd3240 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1314,6 +1314,7 @@ static void nfs4_set_lease_expired(struct nfs_client *clp, int status)
1314 case -NFS4ERR_DELAY: 1314 case -NFS4ERR_DELAY:
1315 case -NFS4ERR_CLID_INUSE: 1315 case -NFS4ERR_CLID_INUSE:
1316 case -EAGAIN: 1316 case -EAGAIN:
1317 case -EKEYEXPIRED:
1317 break; 1318 break;
1318 1319
1319 case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery 1320 case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery