Commit bee42f688c915b510a4aabae4f7a99457137d6f3
Committed by
Trond Myklebust
1 parent
5247fab5c8
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
SUNRPC: register service on creation in current network namespace
Service, using rpcbind (Lockd, NFSd) are starting from userspace call and thus we can use current network namespace. There could be a problem with NFSd service, because it's creation can be called through NFSd fs from different network namespace. But this is a part of "NFSd per net ns" task and will be fixed in future. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 1 changed file with 5 additions and 4 deletions Side-by-side Diff
net/sunrpc/svc.c
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #include <linux/module.h> |
21 | 21 | #include <linux/kthread.h> |
22 | 22 | #include <linux/slab.h> |
23 | +#include <linux/nsproxy.h> | |
23 | 24 | |
24 | 25 | #include <linux/sunrpc/types.h> |
25 | 26 | #include <linux/sunrpc/xdr.h> |
26 | 27 | |
27 | 28 | |
... | ... | @@ -368,16 +369,16 @@ |
368 | 369 | return &serv->sv_pools[pidx % serv->sv_nrpools]; |
369 | 370 | } |
370 | 371 | |
371 | -static int svc_rpcb_setup(struct svc_serv *serv) | |
372 | +static int svc_rpcb_setup(struct svc_serv *serv, struct net *net) | |
372 | 373 | { |
373 | 374 | int err; |
374 | 375 | |
375 | - err = rpcb_create_local(&init_net); | |
376 | + err = rpcb_create_local(net); | |
376 | 377 | if (err) |
377 | 378 | return err; |
378 | 379 | |
379 | 380 | /* Remove any stale portmap registrations */ |
380 | - svc_unregister(serv, &init_net); | |
381 | + svc_unregister(serv, net); | |
381 | 382 | return 0; |
382 | 383 | } |
383 | 384 | |
... | ... | @@ -470,7 +471,7 @@ |
470 | 471 | } |
471 | 472 | |
472 | 473 | if (svc_uses_rpcbind(serv)) { |
473 | - if (svc_rpcb_setup(serv) < 0) { | |
474 | + if (svc_rpcb_setup(serv, current->nsproxy->net_ns) < 0) { | |
474 | 475 | kfree(serv->sv_pools); |
475 | 476 | kfree(serv); |
476 | 477 | return NULL; |