aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/host.c50
-rw-r--r--fs/lockd/mon.c41
2 files changed, 44 insertions, 47 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/*
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 3fc683f46b3e..5954dcb497e4 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -109,30 +109,23 @@ nsm_unmonitor(struct nlm_host *host)
109static struct rpc_clnt * 109static struct rpc_clnt *
110nsm_create(void) 110nsm_create(void)
111{ 111{
112 struct rpc_xprt *xprt; 112 struct sockaddr_in sin = {
113 struct rpc_clnt *clnt; 113 .sin_family = AF_INET,
114 struct sockaddr_in sin; 114 .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
115 115 .sin_port = 0,
116 sin.sin_family = AF_INET; 116 };
117 sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); 117 struct rpc_create_args args = {
118 sin.sin_port = 0; 118 .protocol = IPPROTO_UDP,
119 119 .address = (struct sockaddr *)&sin,
120 xprt = xprt_create_proto(IPPROTO_UDP, &sin, NULL); 120 .addrsize = sizeof(sin),
121 if (IS_ERR(xprt)) 121 .servername = "localhost",
122 return (struct rpc_clnt *)xprt; 122 .program = &nsm_program,
123 xprt->resvport = 1; /* NSM requires a reserved port */ 123 .version = SM_VERSION,
124 124 .authflavor = RPC_AUTH_NULL,
125 clnt = rpc_create_client(xprt, "localhost", 125 .flags = (RPC_CLNT_CREATE_ONESHOT),
126 &nsm_program, SM_VERSION, 126 };
127 RPC_AUTH_NULL); 127
128 if (IS_ERR(clnt)) 128 return rpc_create(&args);
129 goto out_err;
130 clnt->cl_softrtry = 1;
131 clnt->cl_oneshot = 1;
132 return clnt;
133
134out_err:
135 return clnt;
136} 129}
137 130
138/* 131/*