diff options
Diffstat (limited to 'fs/lockd/host.c')
-rw-r--r-- | fs/lockd/host.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 38b0e8a1aec0..703fb038c813 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #define NLM_HOST_REBIND (60 * HZ) | 26 | #define NLM_HOST_REBIND (60 * HZ) |
27 | #define NLM_HOST_EXPIRE ((nrhosts > NLM_HOST_MAX)? 300 * HZ : 120 * HZ) | 27 | #define NLM_HOST_EXPIRE ((nrhosts > NLM_HOST_MAX)? 300 * HZ : 120 * HZ) |
28 | #define NLM_HOST_COLLECT ((nrhosts > NLM_HOST_MAX)? 120 * HZ : 60 * HZ) | 28 | #define NLM_HOST_COLLECT ((nrhosts > NLM_HOST_MAX)? 120 * HZ : 60 * HZ) |
29 | #define NLM_HOST_ADDR(sv) (&(sv)->s_nlmclnt->cl_xprt->addr) | ||
30 | 29 | ||
31 | static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH]; | 30 | static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH]; |
32 | static unsigned long next_gc; | 31 | static unsigned long next_gc; |
@@ -167,7 +166,6 @@ struct rpc_clnt * | |||
167 | nlm_bind_host(struct nlm_host *host) | 166 | nlm_bind_host(struct nlm_host *host) |
168 | { | 167 | { |
169 | struct rpc_clnt *clnt; | 168 | struct rpc_clnt *clnt; |
170 | struct rpc_xprt *xprt; | ||
171 | 169 | ||
172 | dprintk("lockd: nlm_bind_host(%08x)\n", | 170 | dprintk("lockd: nlm_bind_host(%08x)\n", |
173 | (unsigned)ntohl(host->h_addr.sin_addr.s_addr)); | 171 | (unsigned)ntohl(host->h_addr.sin_addr.s_addr)); |
@@ -179,7 +177,6 @@ nlm_bind_host(struct nlm_host *host) | |||
179 | * RPC rebind is required | 177 | * RPC rebind is required |
180 | */ | 178 | */ |
181 | if ((clnt = host->h_rpcclnt) != NULL) { | 179 | if ((clnt = host->h_rpcclnt) != NULL) { |
182 | xprt = clnt->cl_xprt; | ||
183 | if (time_after_eq(jiffies, host->h_nextrebind)) { | 180 | if (time_after_eq(jiffies, host->h_nextrebind)) { |
184 | rpc_force_rebind(clnt); | 181 | rpc_force_rebind(clnt); |
185 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; | 182 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
@@ -187,31 +184,37 @@ nlm_bind_host(struct nlm_host *host) | |||
187 | host->h_nextrebind - jiffies); | 184 | host->h_nextrebind - jiffies); |
188 | } | 185 | } |
189 | } else { | 186 | } else { |
190 | xprt = xprt_create_proto(host->h_proto, &host->h_addr, NULL); | 187 | unsigned long increment = nlmsvc_timeout * HZ; |
191 | if (IS_ERR(xprt)) | 188 | struct rpc_timeout timeparms = { |
192 | goto forgetit; | 189 | .to_initval = increment, |
193 | 190 | .to_increment = increment, | |
194 | xprt_set_timeout(&xprt->timeout, 5, nlmsvc_timeout); | 191 | .to_maxval = increment * 6UL, |
195 | xprt->resvport = 1; /* NLM requires a reserved port */ | 192 | .to_retries = 5U, |
196 | 193 | }; | |
197 | /* Existing NLM servers accept AUTH_UNIX only */ | 194 | struct rpc_create_args args = { |
198 | clnt = rpc_new_client(xprt, host->h_name, &nlm_program, | 195 | .protocol = host->h_proto, |
199 | host->h_version, RPC_AUTH_UNIX); | 196 | .address = (struct sockaddr *)&host->h_addr, |
200 | if (IS_ERR(clnt)) | 197 | .addrsize = sizeof(host->h_addr), |
201 | goto forgetit; | 198 | .timeout = &timeparms, |
202 | clnt->cl_autobind = 1; /* turn on pmap queries */ | 199 | .servername = host->h_name, |
203 | clnt->cl_softrtry = 1; /* All queries are soft */ | 200 | .program = &nlm_program, |
204 | 201 | .version = host->h_version, | |
205 | host->h_rpcclnt = clnt; | 202 | .authflavor = RPC_AUTH_UNIX, |
203 | .flags = (RPC_CLNT_CREATE_HARDRTRY | | ||
204 | RPC_CLNT_CREATE_AUTOBIND), | ||
205 | }; | ||
206 | |||
207 | clnt = rpc_create(&args); | ||
208 | if (!IS_ERR(clnt)) | ||
209 | host->h_rpcclnt = clnt; | ||
210 | else { | ||
211 | printk("lockd: couldn't create RPC handle for %s\n", host->h_name); | ||
212 | clnt = NULL; | ||
213 | } | ||
206 | } | 214 | } |
207 | 215 | ||
208 | mutex_unlock(&host->h_mutex); | 216 | mutex_unlock(&host->h_mutex); |
209 | return clnt; | 217 | return clnt; |
210 | |||
211 | forgetit: | ||
212 | printk("lockd: couldn't create RPC handle for %s\n", host->h_name); | ||
213 | mutex_unlock(&host->h_mutex); | ||
214 | return NULL; | ||
215 | } | 218 | } |
216 | 219 | ||
217 | /* | 220 | /* |