diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-04-24 14:29:33 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-04-24 14:29:33 -0400 |
commit | 1bd714f2a14aa4d6a5570956fcec64530b007e4a (patch) | |
tree | 7b468cf5e79a13e3931dda377b95c759475c95ae /fs/nfs | |
parent | 7494d00c7b826b6ceb79ec33892bd0ef59be5614 (diff) |
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>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 13 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 50c814828fcb..69c0f3c5ee7a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3751,7 +3751,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, | |||
3751 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", | 3751 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", |
3752 | clp->cl_ipaddr, port >> 8, port & 255); | 3752 | clp->cl_ipaddr, port >> 8, port & 255); |
3753 | 3753 | ||
3754 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | 3754 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
3755 | if (status != -NFS4ERR_CLID_INUSE) | 3755 | if (status != -NFS4ERR_CLID_INUSE) |
3756 | break; | 3756 | break; |
3757 | if (loop != 0) { | 3757 | if (loop != 0) { |
@@ -3779,7 +3779,7 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp, | |||
3779 | int status; | 3779 | int status; |
3780 | 3780 | ||
3781 | now = jiffies; | 3781 | now = jiffies; |
3782 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | 3782 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
3783 | if (status == 0) { | 3783 | if (status == 0) { |
3784 | spin_lock(&clp->cl_lock); | 3784 | spin_lock(&clp->cl_lock); |
3785 | clp->cl_lease_time = fsinfo.lease_time * HZ; | 3785 | 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) | |||
4793 | init_utsname()->domainname, | 4793 | init_utsname()->domainname, |
4794 | clp->cl_rpcclient->cl_auth->au_flavor); | 4794 | clp->cl_rpcclient->cl_auth->au_flavor); |
4795 | 4795 | ||
4796 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | 4796 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
4797 | if (!status) | 4797 | if (!status) |
4798 | status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags); | 4798 | status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags); |
4799 | dprintk("<-- %s status= %d\n", __func__, status); | 4799 | 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) | |||
4876 | .rpc_client = clp->cl_rpcclient, | 4876 | .rpc_client = clp->cl_rpcclient, |
4877 | .rpc_message = &msg, | 4877 | .rpc_message = &msg, |
4878 | .callback_ops = &nfs4_get_lease_time_ops, | 4878 | .callback_ops = &nfs4_get_lease_time_ops, |
4879 | .callback_data = &data | 4879 | .callback_data = &data, |
4880 | .flags = RPC_TASK_TIMEOUT, | ||
4880 | }; | 4881 | }; |
4881 | int status; | 4882 | int status; |
4882 | 4883 | ||
@@ -5178,7 +5179,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp) | |||
5178 | nfs4_init_channel_attrs(&args); | 5179 | nfs4_init_channel_attrs(&args); |
5179 | args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN); | 5180 | args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN); |
5180 | 5181 | ||
5181 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0); | 5182 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
5182 | 5183 | ||
5183 | if (!status) | 5184 | if (!status) |
5184 | /* Verify the session's negotiated channel_attrs values */ | 5185 | /* Verify the session's negotiated channel_attrs values */ |
@@ -5245,7 +5246,7 @@ int nfs4_proc_destroy_session(struct nfs4_session *session) | |||
5245 | msg.rpc_argp = session; | 5246 | msg.rpc_argp = session; |
5246 | msg.rpc_resp = NULL; | 5247 | msg.rpc_resp = NULL; |
5247 | msg.rpc_cred = NULL; | 5248 | 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); |
5249 | 5250 | ||
5250 | if (status) | 5251 | if (status) |
5251 | printk(KERN_WARNING | 5252 | printk(KERN_WARNING |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 4a810c8b0753..036f5adc9e1f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1604,6 +1604,7 @@ static void nfs4_set_lease_expired(struct nfs_client *clp, int status) | |||
1604 | clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); | 1604 | clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); |
1605 | break; | 1605 | break; |
1606 | case -NFS4ERR_DELAY: | 1606 | case -NFS4ERR_DELAY: |
1607 | case -ETIMEDOUT: | ||
1607 | case -EAGAIN: | 1608 | case -EAGAIN: |
1608 | ssleep(1); | 1609 | ssleep(1); |
1609 | break; | 1610 | break; |