diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-08 17:50:28 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-08 18:01:59 -0400 |
commit | bc7a05ca5156915a5aada26d64ee035fdd5e5d25 (patch) | |
tree | 3c4d9053ef255e1e21058b94013c6e059b27c735 /fs/nfs | |
parent | 826e0013082a86fb16f2e414314a5268f744fb96 (diff) |
NFSv4: Handle timeouts correctly when probing for lease validity
When we send a RENEW or SEQUENCE operation in order to probe if the
lease is still valid, we want it to be able to time out since the
lease we are probing is likely to time out too. Currently, because
we use soft mount semantics for these RPC calls, the return value
is EIO, which causes the state manager to exit with an "unhandled
error" message.
This patch changes the call semantics, so that the RPC layer returns
ETIMEDOUT instead of EIO. We then have the state manager default to
a simple retry instead of exiting.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index bdf3d07ce974..264ddb16255f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3797,7 +3797,7 @@ static int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred, | |||
3797 | return -ENOMEM; | 3797 | return -ENOMEM; |
3798 | data->client = clp; | 3798 | data->client = clp; |
3799 | data->timestamp = jiffies; | 3799 | data->timestamp = jiffies; |
3800 | return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, | 3800 | return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT, |
3801 | &nfs4_renew_ops, data); | 3801 | &nfs4_renew_ops, data); |
3802 | } | 3802 | } |
3803 | 3803 | ||
@@ -3811,7 +3811,7 @@ static int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) | |||
3811 | unsigned long now = jiffies; | 3811 | unsigned long now = jiffies; |
3812 | int status; | 3812 | int status; |
3813 | 3813 | ||
3814 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | 3814 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
3815 | if (status < 0) | 3815 | if (status < 0) |
3816 | return status; | 3816 | return status; |
3817 | do_renew_lease(clp, now); | 3817 | do_renew_lease(clp, now); |
@@ -5959,7 +5959,7 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, | |||
5959 | .rpc_client = clp->cl_rpcclient, | 5959 | .rpc_client = clp->cl_rpcclient, |
5960 | .rpc_message = &msg, | 5960 | .rpc_message = &msg, |
5961 | .callback_ops = &nfs41_sequence_ops, | 5961 | .callback_ops = &nfs41_sequence_ops, |
5962 | .flags = RPC_TASK_ASYNC | RPC_TASK_SOFT, | 5962 | .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT, |
5963 | }; | 5963 | }; |
5964 | 5964 | ||
5965 | if (!atomic_inc_not_zero(&clp->cl_count)) | 5965 | if (!atomic_inc_not_zero(&clp->cl_count)) |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index b924bdd69494..1eb17285c99a 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1739,6 +1739,10 @@ static int nfs4_check_lease(struct nfs_client *clp) | |||
1739 | } | 1739 | } |
1740 | status = ops->renew_lease(clp, cred); | 1740 | status = ops->renew_lease(clp, cred); |
1741 | put_rpccred(cred); | 1741 | put_rpccred(cred); |
1742 | if (status == -ETIMEDOUT) { | ||
1743 | set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); | ||
1744 | return 0; | ||
1745 | } | ||
1742 | out: | 1746 | out: |
1743 | return nfs4_recovery_handle_error(clp, status); | 1747 | return nfs4_recovery_handle_error(clp, status); |
1744 | } | 1748 | } |