diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:06:19 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:06:19 -0400 |
commit | a78cb57a106fceeba26da2907db9d8886700e1dc (patch) | |
tree | d9127810fa7f9d68232488bf33b947195c5d1e26 /fs/nfs/nfs4proc.c | |
parent | dd8ac1da4190139de70da18823ff8f5992a649ae (diff) |
NFSv4: Don't loop forever on state recovery failure...
If the server is broken, then retrying forever won't fix it. We
should just give up after a while, and return an error to the user.
We set the number of retries to 10 for now...
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6917311f201c..d95f7f9e60c4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -61,6 +61,8 @@ | |||
61 | #define NFS4_POLL_RETRY_MIN (HZ/10) | 61 | #define NFS4_POLL_RETRY_MIN (HZ/10) |
62 | #define NFS4_POLL_RETRY_MAX (15*HZ) | 62 | #define NFS4_POLL_RETRY_MAX (15*HZ) |
63 | 63 | ||
64 | #define NFS4_MAX_LOOP_ON_RECOVER (10) | ||
65 | |||
64 | struct nfs4_opendata; | 66 | struct nfs4_opendata; |
65 | static int _nfs4_proc_open(struct nfs4_opendata *data); | 67 | static int _nfs4_proc_open(struct nfs4_opendata *data); |
66 | static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); | 68 | static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); |
@@ -426,17 +428,19 @@ out: | |||
426 | static int nfs4_recover_session(struct nfs4_session *session) | 428 | static int nfs4_recover_session(struct nfs4_session *session) |
427 | { | 429 | { |
428 | struct nfs_client *clp = session->clp; | 430 | struct nfs_client *clp = session->clp; |
431 | unsigned int loop; | ||
429 | int ret; | 432 | int ret; |
430 | 433 | ||
431 | for (;;) { | 434 | for (loop = NFS4_MAX_LOOP_ON_RECOVER; loop != 0; loop--) { |
432 | ret = nfs4_wait_clnt_recover(clp); | 435 | ret = nfs4_wait_clnt_recover(clp); |
433 | if (ret != 0) | 436 | if (ret != 0) |
434 | return ret; | 437 | break; |
435 | if (!test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) | 438 | if (!test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) |
436 | break; | 439 | break; |
437 | nfs4_schedule_state_manager(clp); | 440 | nfs4_schedule_state_manager(clp); |
441 | ret = -EIO; | ||
438 | } | 442 | } |
439 | return 0; | 443 | return ret; |
440 | } | 444 | } |
441 | 445 | ||
442 | static int nfs41_setup_sequence(struct nfs4_session *session, | 446 | static int nfs41_setup_sequence(struct nfs4_session *session, |
@@ -1444,18 +1448,20 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
1444 | static int nfs4_recover_expired_lease(struct nfs_server *server) | 1448 | static int nfs4_recover_expired_lease(struct nfs_server *server) |
1445 | { | 1449 | { |
1446 | struct nfs_client *clp = server->nfs_client; | 1450 | struct nfs_client *clp = server->nfs_client; |
1451 | unsigned int loop; | ||
1447 | int ret; | 1452 | int ret; |
1448 | 1453 | ||
1449 | for (;;) { | 1454 | for (loop = NFS4_MAX_LOOP_ON_RECOVER; loop != 0; loop--) { |
1450 | ret = nfs4_wait_clnt_recover(clp); | 1455 | ret = nfs4_wait_clnt_recover(clp); |
1451 | if (ret != 0) | 1456 | if (ret != 0) |
1452 | return ret; | 1457 | break; |
1453 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && | 1458 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && |
1454 | !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) | 1459 | !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) |
1455 | break; | 1460 | break; |
1456 | nfs4_schedule_state_recovery(clp); | 1461 | nfs4_schedule_state_recovery(clp); |
1462 | ret = -EIO; | ||
1457 | } | 1463 | } |
1458 | return 0; | 1464 | return ret; |
1459 | } | 1465 | } |
1460 | 1466 | ||
1461 | /* | 1467 | /* |