diff options
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r-- | fs/lockd/svc.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 566932b98fd3..abf83881f68a 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -193,20 +193,30 @@ lockd(void *vrqstp) | |||
193 | return 0; | 193 | return 0; |
194 | } | 194 | } |
195 | 195 | ||
196 | static int create_lockd_listener(struct svc_serv *serv, char *name, | 196 | static int create_lockd_listener(struct svc_serv *serv, const char *name, |
197 | unsigned short port) | 197 | const int family, const unsigned short port) |
198 | { | 198 | { |
199 | struct svc_xprt *xprt; | 199 | struct svc_xprt *xprt; |
200 | 200 | ||
201 | xprt = svc_find_xprt(serv, name, 0, 0); | 201 | xprt = svc_find_xprt(serv, name, family, 0); |
202 | if (xprt == NULL) | 202 | if (xprt == NULL) |
203 | return svc_create_xprt(serv, name, PF_INET, | 203 | return svc_create_xprt(serv, name, family, port, |
204 | port, SVC_SOCK_DEFAULTS); | 204 | SVC_SOCK_DEFAULTS); |
205 | |||
206 | svc_xprt_put(xprt); | 205 | svc_xprt_put(xprt); |
207 | return 0; | 206 | return 0; |
208 | } | 207 | } |
209 | 208 | ||
209 | static int create_lockd_family(struct svc_serv *serv, const int family) | ||
210 | { | ||
211 | int err; | ||
212 | |||
213 | err = create_lockd_listener(serv, "udp", family, nlm_udpport); | ||
214 | if (err < 0) | ||
215 | return err; | ||
216 | |||
217 | return create_lockd_listener(serv, "tcp", family, nlm_tcpport); | ||
218 | } | ||
219 | |||
210 | /* | 220 | /* |
211 | * Ensure there are active UDP and TCP listeners for lockd. | 221 | * Ensure there are active UDP and TCP listeners for lockd. |
212 | * | 222 | * |
@@ -222,13 +232,15 @@ static int make_socks(struct svc_serv *serv) | |||
222 | static int warned; | 232 | static int warned; |
223 | int err; | 233 | int err; |
224 | 234 | ||
225 | err = create_lockd_listener(serv, "udp", nlm_udpport); | 235 | err = create_lockd_family(serv, PF_INET); |
226 | if (err < 0) | 236 | if (err < 0) |
227 | goto out_err; | 237 | goto out_err; |
228 | 238 | ||
229 | err = create_lockd_listener(serv, "tcp", nlm_tcpport); | 239 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
230 | if (err < 0) | 240 | err = create_lockd_family(serv, PF_INET6); |
241 | if (err < 0 && err != -EAFNOSUPPORT) | ||
231 | goto out_err; | 242 | goto out_err; |
243 | #endif /* CONFIG_IPV6 || CONFIG_IPV6_MODULE */ | ||
232 | 244 | ||
233 | warned = 0; | 245 | warned = 0; |
234 | return 0; | 246 | return 0; |