diff options
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/svc.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index f013aed11533..36396fc058c5 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -189,25 +189,28 @@ lockd(void *vrqstp) | |||
189 | } | 189 | } |
190 | 190 | ||
191 | /* | 191 | /* |
192 | * Make any sockets that are needed but not present. | 192 | * Ensure there are active UDP and TCP listeners for lockd. |
193 | * If nlm_udpport or nlm_tcpport were set as module | 193 | * |
194 | * options, make those sockets unconditionally | 194 | * Even if we have only TCP NFS mounts and/or TCP NFSDs, some |
195 | * local services (such as rpc.statd) still require UDP, and | ||
196 | * some NFS servers do not yet support NLM over TCP. | ||
197 | * | ||
198 | * Returns zero if all listeners are available; otherwise a | ||
199 | * negative errno value is returned. | ||
195 | */ | 200 | */ |
196 | static int make_socks(struct svc_serv *serv, int proto) | 201 | static int make_socks(struct svc_serv *serv) |
197 | { | 202 | { |
198 | static int warned; | 203 | static int warned; |
199 | struct svc_xprt *xprt; | 204 | struct svc_xprt *xprt; |
200 | int err = 0; | 205 | int err = 0; |
201 | 206 | ||
202 | if (proto == IPPROTO_UDP || nlm_udpport) { | 207 | xprt = svc_find_xprt(serv, "udp", 0, 0); |
203 | xprt = svc_find_xprt(serv, "udp", 0, 0); | 208 | if (!xprt) |
204 | if (!xprt) | 209 | err = svc_create_xprt(serv, "udp", nlm_udpport, |
205 | err = svc_create_xprt(serv, "udp", nlm_udpport, | 210 | SVC_SOCK_DEFAULTS); |
206 | SVC_SOCK_DEFAULTS); | 211 | else |
207 | else | 212 | svc_xprt_put(xprt); |
208 | svc_xprt_put(xprt); | 213 | if (err >= 0) { |
209 | } | ||
210 | if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) { | ||
211 | xprt = svc_find_xprt(serv, "tcp", 0, 0); | 214 | xprt = svc_find_xprt(serv, "tcp", 0, 0); |
212 | if (!xprt) | 215 | if (!xprt) |
213 | err = svc_create_xprt(serv, "tcp", nlm_tcpport, | 216 | err = svc_create_xprt(serv, "tcp", nlm_tcpport, |
@@ -237,11 +240,8 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */ | |||
237 | /* | 240 | /* |
238 | * Check whether we're already up and running. | 241 | * Check whether we're already up and running. |
239 | */ | 242 | */ |
240 | if (nlmsvc_rqst) { | 243 | if (nlmsvc_rqst) |
241 | if (proto) | ||
242 | error = make_socks(nlmsvc_rqst->rq_server, proto); | ||
243 | goto out; | 244 | goto out; |
244 | } | ||
245 | 245 | ||
246 | /* | 246 | /* |
247 | * Sanity check: if there's no pid, | 247 | * Sanity check: if there's no pid, |
@@ -258,7 +258,8 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */ | |||
258 | goto out; | 258 | goto out; |
259 | } | 259 | } |
260 | 260 | ||
261 | if ((error = make_socks(serv, proto)) < 0) | 261 | error = make_socks(serv); |
262 | if (error < 0) | ||
262 | goto destroy_and_out; | 263 | goto destroy_and_out; |
263 | 264 | ||
264 | /* | 265 | /* |