aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r--fs/lockd/svc.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 3e5f9f079110..cf3899aec375 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -204,6 +204,19 @@ lockd(void *vrqstp)
204 return 0; 204 return 0;
205} 205}
206 206
207static int create_lockd_listener(struct svc_serv *serv, char *name,
208 unsigned short port)
209{
210 struct svc_xprt *xprt;
211
212 xprt = svc_find_xprt(serv, name, 0, 0);
213 if (xprt == NULL)
214 return svc_create_xprt(serv, name, port, SVC_SOCK_DEFAULTS);
215
216 svc_xprt_put(xprt);
217 return 0;
218}
219
207/* 220/*
208 * Ensure there are active UDP and TCP listeners for lockd. 221 * Ensure there are active UDP and TCP listeners for lockd.
209 * 222 *
@@ -217,23 +230,11 @@ lockd(void *vrqstp)
217static int make_socks(struct svc_serv *serv) 230static int make_socks(struct svc_serv *serv)
218{ 231{
219 static int warned; 232 static int warned;
220 struct svc_xprt *xprt;
221 int err = 0; 233 int err = 0;
222 234
223 xprt = svc_find_xprt(serv, "udp", 0, 0); 235 err = create_lockd_listener(serv, "udp", nlm_udpport);
224 if (!xprt) 236 if (err >= 0)
225 err = svc_create_xprt(serv, "udp", nlm_udpport, 237 err = create_lockd_listener(serv, "tcp", nlm_tcpport);
226 SVC_SOCK_DEFAULTS);
227 else
228 svc_xprt_put(xprt);
229 if (err >= 0) {
230 xprt = svc_find_xprt(serv, "tcp", 0, 0);
231 if (!xprt)
232 err = svc_create_xprt(serv, "tcp", nlm_tcpport,
233 SVC_SOCK_DEFAULTS);
234 else
235 svc_xprt_put(xprt);
236 }
237 if (err >= 0) { 238 if (err >= 0) {
238 warned = 0; 239 warned = 0;
239 err = 0; 240 err = 0;