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.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 82e2192a0d5c..08226464e563 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -219,19 +219,6 @@ lockd(struct svc_rqst *rqstp)
219 module_put_and_exit(0); 219 module_put_and_exit(0);
220} 220}
221 221
222
223static int find_socket(struct svc_serv *serv, int proto)
224{
225 struct svc_sock *svsk;
226 int found = 0;
227 list_for_each_entry(svsk, &serv->sv_permsocks, sk_list)
228 if (svsk->sk_sk->sk_protocol == proto) {
229 found = 1;
230 break;
231 }
232 return found;
233}
234
235/* 222/*
236 * Make any sockets that are needed but not present. 223 * Make any sockets that are needed but not present.
237 * If nlm_udpport or nlm_tcpport were set as module 224 * If nlm_udpport or nlm_tcpport were set as module
@@ -240,17 +227,25 @@ static int find_socket(struct svc_serv *serv, int proto)
240static int make_socks(struct svc_serv *serv, int proto) 227static int make_socks(struct svc_serv *serv, int proto)
241{ 228{
242 static int warned; 229 static int warned;
230 struct svc_xprt *xprt;
243 int err = 0; 231 int err = 0;
244 232
245 if (proto == IPPROTO_UDP || nlm_udpport) 233 if (proto == IPPROTO_UDP || nlm_udpport) {
246 if (!find_socket(serv, IPPROTO_UDP)) 234 xprt = svc_find_xprt(serv, "udp", 0, 0);
247 err = svc_makesock(serv, IPPROTO_UDP, nlm_udpport, 235 if (!xprt)
248 SVC_SOCK_DEFAULTS); 236 err = svc_create_xprt(serv, "udp", nlm_udpport,
249 if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) 237 SVC_SOCK_DEFAULTS);
250 if (!find_socket(serv, IPPROTO_TCP)) 238 else
251 err = svc_makesock(serv, IPPROTO_TCP, nlm_tcpport, 239 svc_xprt_put(xprt);
252 SVC_SOCK_DEFAULTS); 240 }
253 241 if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) {
242 xprt = svc_find_xprt(serv, "tcp", 0, 0);
243 if (!xprt)
244 err = svc_create_xprt(serv, "tcp", nlm_tcpport,
245 SVC_SOCK_DEFAULTS);
246 else
247 svc_xprt_put(xprt);
248 }
254 if (err >= 0) { 249 if (err >= 0) {
255 warned = 0; 250 warned = 0;
256 err = 0; 251 err = 0;