From: Stanislav Kinsbursky Date: Fri, 13 Jan 2012 10:02:56 +0000 (+0400) Subject: SUNRPC: register service on creation in current network namespace X-Git-Tag: firefly_0821_release~3680^2~3284^2~164 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bee42f688c915b510a4aabae4f7a99457137d6f3;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Trond Myklebust --- diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index a2d3330b70de..cb2caaee2af9 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -368,16 +369,16 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu) return &serv->sv_pools[pidx % serv->sv_nrpools]; } -static int svc_rpcb_setup(struct svc_serv *serv) +static int svc_rpcb_setup(struct svc_serv *serv, struct net *net) { int err; - err = rpcb_create_local(&init_net); + err = rpcb_create_local(net); if (err) return err; /* Remove any stale portmap registrations */ - svc_unregister(serv, &init_net); + svc_unregister(serv, net); return 0; } @@ -470,7 +471,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, } if (svc_uses_rpcbind(serv)) { - if (svc_rpcb_setup(serv) < 0) { + if (svc_rpcb_setup(serv, current->nsproxy->net_ns) < 0) { kfree(serv->sv_pools); kfree(serv); return NULL;