Commit bc7a05ca authored by Trond Myklebust's avatar Trond Myklebust

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 826e0013
...@@ -3797,7 +3797,7 @@ static int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred, ...@@ -3797,7 +3797,7 @@ static int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred,
return -ENOMEM; return -ENOMEM;
data->client = clp; data->client = clp;
data->timestamp = jiffies; data->timestamp = jiffies;
return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT,
&nfs4_renew_ops, data); &nfs4_renew_ops, data);
} }
...@@ -3811,7 +3811,7 @@ static int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) ...@@ -3811,7 +3811,7 @@ static int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred)
unsigned long now = jiffies; unsigned long now = jiffies;
int status; int status;
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
if (status < 0) if (status < 0)
return status; return status;
do_renew_lease(clp, now); do_renew_lease(clp, now);
...@@ -5959,7 +5959,7 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, ...@@ -5959,7 +5959,7 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp,
.rpc_client = clp->cl_rpcclient, .rpc_client = clp->cl_rpcclient,
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs41_sequence_ops, .callback_ops = &nfs41_sequence_ops,
.flags = RPC_TASK_ASYNC | RPC_TASK_SOFT, .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT,
}; };
if (!atomic_inc_not_zero(&clp->cl_count)) if (!atomic_inc_not_zero(&clp->cl_count))
......
...@@ -1739,6 +1739,10 @@ static int nfs4_check_lease(struct nfs_client *clp) ...@@ -1739,6 +1739,10 @@ static int nfs4_check_lease(struct nfs_client *clp)
} }
status = ops->renew_lease(clp, cred); status = ops->renew_lease(clp, cred);
put_rpccred(cred); put_rpccred(cred);
if (status == -ETIMEDOUT) {
set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
return 0;
}
out: out:
return nfs4_recovery_handle_error(clp, status); return nfs4_recovery_handle_error(clp, status);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment