Skip to content

Commit 1bd714f

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
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 <[email protected]>
1 parent 7494d00 commit 1bd714f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

fs/nfs/nfs4proc.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,7 +3751,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
37513751
sizeof(setclientid.sc_uaddr), "%s.%u.%u",
37523752
clp->cl_ipaddr, port >> 8, port & 255);
37533753

3754-
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
3754+
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
37553755
if (status != -NFS4ERR_CLID_INUSE)
37563756
break;
37573757
if (loop != 0) {
@@ -3779,7 +3779,7 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp,
37793779
int status;
37803780

37813781
now = jiffies;
3782-
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
3782+
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
37833783
if (status == 0) {
37843784
spin_lock(&clp->cl_lock);
37853785
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)
47934793
init_utsname()->domainname,
47944794
clp->cl_rpcclient->cl_auth->au_flavor);
47954795

4796-
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
4796+
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
47974797
if (!status)
47984798
status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags);
47994799
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)
48764876
.rpc_client = clp->cl_rpcclient,
48774877
.rpc_message = &msg,
48784878
.callback_ops = &nfs4_get_lease_time_ops,
4879-
.callback_data = &data
4879+
.callback_data = &data,
4880+
.flags = RPC_TASK_TIMEOUT,
48804881
};
48814882
int status;
48824883

@@ -5178,7 +5179,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp)
51785179
nfs4_init_channel_attrs(&args);
51795180
args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN);
51805181

5181-
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0);
5182+
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
51825183

51835184
if (!status)
51845185
/* Verify the session's negotiated channel_attrs values */
@@ -5245,7 +5246,7 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)
52455246
msg.rpc_argp = session;
52465247
msg.rpc_resp = NULL;
52475248
msg.rpc_cred = NULL;
5248-
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0);
5249+
status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
52495250

52505251
if (status)
52515252
printk(KERN_WARNING

fs/nfs/nfs4state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,7 @@ static void nfs4_set_lease_expired(struct nfs_client *clp, int status)
16041604
clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
16051605
break;
16061606
case -NFS4ERR_DELAY:
1607+
case -ETIMEDOUT:
16071608
case -EAGAIN:
16081609
ssleep(1);
16091610
break;

0 commit comments

Comments
 (0)