NFSv4: Ensure that clientid and session establishment can time out
The following patch ensures that we do not get permanently trapped in the RPC layer when trying to establish a new client id or session. This again ensures that the state manager can finish in a timely fashion when the last filesystem to reference the nfs_client exits. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
7494d00c7b
commit
1bd714f2a1
@ -3751,7 +3751,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
|
|||||||
sizeof(setclientid.sc_uaddr), "%s.%u.%u",
|
sizeof(setclientid.sc_uaddr), "%s.%u.%u",
|
||||||
clp->cl_ipaddr, port >> 8, port & 255);
|
clp->cl_ipaddr, port >> 8, port & 255);
|
||||||
|
|
||||||
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
|
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
|
||||||
if (status != -NFS4ERR_CLID_INUSE)
|
if (status != -NFS4ERR_CLID_INUSE)
|
||||||
break;
|
break;
|
||||||
if (loop != 0) {
|
if (loop != 0) {
|
||||||
@ -3779,7 +3779,7 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp,
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
now = jiffies;
|
now = jiffies;
|
||||||
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) {
|
||||||
spin_lock(&clp->cl_lock);
|
spin_lock(&clp->cl_lock);
|
||||||
clp->cl_lease_time = fsinfo.lease_time * HZ;
|
clp->cl_lease_time = fsinfo.lease_time * HZ;
|
||||||
@ -4793,7 +4793,7 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
|
|||||||
init_utsname()->domainname,
|
init_utsname()->domainname,
|
||||||
clp->cl_rpcclient->cl_auth->au_flavor);
|
clp->cl_rpcclient->cl_auth->au_flavor);
|
||||||
|
|
||||||
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
|
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
|
||||||
if (!status)
|
if (!status)
|
||||||
status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags);
|
status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags);
|
||||||
dprintk("<-- %s status= %d\n", __func__, status);
|
dprintk("<-- %s status= %d\n", __func__, status);
|
||||||
@ -4876,7 +4876,8 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
|
|||||||
.rpc_client = clp->cl_rpcclient,
|
.rpc_client = clp->cl_rpcclient,
|
||||||
.rpc_message = &msg,
|
.rpc_message = &msg,
|
||||||
.callback_ops = &nfs4_get_lease_time_ops,
|
.callback_ops = &nfs4_get_lease_time_ops,
|
||||||
.callback_data = &data
|
.callback_data = &data,
|
||||||
|
.flags = RPC_TASK_TIMEOUT,
|
||||||
};
|
};
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
@ -5178,7 +5179,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp)
|
|||||||
nfs4_init_channel_attrs(&args);
|
nfs4_init_channel_attrs(&args);
|
||||||
args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN);
|
args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN);
|
||||||
|
|
||||||
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0);
|
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
|
||||||
|
|
||||||
if (!status)
|
if (!status)
|
||||||
/* Verify the session's negotiated channel_attrs values */
|
/* Verify the session's negotiated channel_attrs values */
|
||||||
@ -5245,7 +5246,7 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)
|
|||||||
msg.rpc_argp = session;
|
msg.rpc_argp = session;
|
||||||
msg.rpc_resp = NULL;
|
msg.rpc_resp = NULL;
|
||||||
msg.rpc_cred = NULL;
|
msg.rpc_cred = NULL;
|
||||||
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0);
|
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
|
@ -1604,6 +1604,7 @@ static void nfs4_set_lease_expired(struct nfs_client *clp, int status)
|
|||||||
clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
|
clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
|
||||||
break;
|
break;
|
||||||
case -NFS4ERR_DELAY:
|
case -NFS4ERR_DELAY:
|
||||||
|
case -ETIMEDOUT:
|
||||||
case -EAGAIN:
|
case -EAGAIN:
|
||||||
ssleep(1);
|
ssleep(1);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user