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