diff options
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r-- | fs/lockd/svc.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 73c9ebf09301..90dec426bfd8 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -251,6 +251,45 @@ out_err: | |||
251 | return err; | 251 | return err; |
252 | } | 252 | } |
253 | 253 | ||
254 | static int lockd_up_net(struct net *net) | ||
255 | { | ||
256 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
257 | struct svc_serv *serv = nlmsvc_rqst->rq_server; | ||
258 | int error; | ||
259 | |||
260 | if (ln->nlmsvc_users) | ||
261 | return 0; | ||
262 | |||
263 | error = svc_rpcb_setup(serv, net); | ||
264 | if (error) | ||
265 | goto err_rpcb; | ||
266 | |||
267 | error = make_socks(serv, net); | ||
268 | if (error < 0) | ||
269 | goto err_socks; | ||
270 | return 0; | ||
271 | |||
272 | err_socks: | ||
273 | svc_rpcb_cleanup(serv, net); | ||
274 | err_rpcb: | ||
275 | return error; | ||
276 | } | ||
277 | |||
278 | static void lockd_down_net(struct net *net) | ||
279 | { | ||
280 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
281 | struct svc_serv *serv = nlmsvc_rqst->rq_server; | ||
282 | |||
283 | if (ln->nlmsvc_users) { | ||
284 | if (--ln->nlmsvc_users == 0) | ||
285 | svc_shutdown_net(serv, net); | ||
286 | } else { | ||
287 | printk(KERN_ERR "lockd_down_net: no users! task=%p, net=%p\n", | ||
288 | nlmsvc_task, net); | ||
289 | BUG(); | ||
290 | } | ||
291 | } | ||
292 | |||
254 | /* | 293 | /* |
255 | * Bring up the lockd process if it's not already up. | 294 | * Bring up the lockd process if it's not already up. |
256 | */ | 295 | */ |
@@ -264,8 +303,10 @@ int lockd_up(void) | |||
264 | /* | 303 | /* |
265 | * Check whether we're already up and running. | 304 | * Check whether we're already up and running. |
266 | */ | 305 | */ |
267 | if (nlmsvc_rqst) | 306 | if (nlmsvc_rqst) { |
307 | error = lockd_up_net(net); | ||
268 | goto out; | 308 | goto out; |
309 | } | ||
269 | 310 | ||
270 | /* | 311 | /* |
271 | * Sanity check: if there's no pid, | 312 | * Sanity check: if there's no pid, |
@@ -339,8 +380,10 @@ lockd_down(void) | |||
339 | { | 380 | { |
340 | mutex_lock(&nlmsvc_mutex); | 381 | mutex_lock(&nlmsvc_mutex); |
341 | if (nlmsvc_users) { | 382 | if (nlmsvc_users) { |
342 | if (--nlmsvc_users) | 383 | if (--nlmsvc_users) { |
384 | lockd_down_net(current->nsproxy->net_ns); | ||
343 | goto out; | 385 | goto out; |
386 | } | ||
344 | } else { | 387 | } else { |
345 | printk(KERN_ERR "lockd_down: no users! task=%p\n", | 388 | printk(KERN_ERR "lockd_down: no users! task=%p\n", |
346 | nlmsvc_task); | 389 | nlmsvc_task); |