SUNRPC: parametrize local rpcbind clients creation with net ns

These client are per network namespace and thus can be created for different
network namespaces.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Stanislav Kinsbursky 2012-01-13 12:52:51 +04:00 committed by Trond Myklebust
parent 977ac31573
commit f7a30c18e8
3 changed files with 7 additions and 8 deletions

View file

@ -136,8 +136,8 @@ void rpc_shutdown_client(struct rpc_clnt *);
void rpc_release_client(struct rpc_clnt *); void rpc_release_client(struct rpc_clnt *);
void rpc_task_release_client(struct rpc_task *); void rpc_task_release_client(struct rpc_task *);
int rpcb_create_local(void); int rpcb_create_local(struct net *);
void rpcb_put_local(void); void rpcb_put_local(struct net *);
int rpcb_register(struct net *, u32, u32, int, unsigned short); int rpcb_register(struct net *, u32, u32, int, unsigned short);
int rpcb_v4_register(struct net *net, const u32 program, int rpcb_v4_register(struct net *net, const u32 program,
const u32 version, const u32 version,

View file

@ -175,9 +175,9 @@ static int rpcb_get_local(struct net *net)
return cnt; return cnt;
} }
void rpcb_put_local(void) void rpcb_put_local(struct net *net)
{ {
struct sunrpc_net *sn = net_generic(&init_net, sunrpc_net_id); struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
struct rpc_clnt *clnt = sn->rpcb_local_clnt; struct rpc_clnt *clnt = sn->rpcb_local_clnt;
struct rpc_clnt *clnt4 = sn->rpcb_local_clnt4; struct rpc_clnt *clnt4 = sn->rpcb_local_clnt4;
int shutdown; int shutdown;
@ -323,11 +323,10 @@ static int rpcb_create_local_net(struct net *net)
* Returns zero on success, otherwise a negative errno value * Returns zero on success, otherwise a negative errno value
* is returned. * is returned.
*/ */
int rpcb_create_local(void) int rpcb_create_local(struct net *net)
{ {
static DEFINE_MUTEX(rpcb_create_local_mutex); static DEFINE_MUTEX(rpcb_create_local_mutex);
int result = 0; int result = 0;
struct net *net = &init_net;
if (rpcb_get_local(net)) if (rpcb_get_local(net))
return result; return result;

View file

@ -372,7 +372,7 @@ static int svc_rpcb_setup(struct svc_serv *serv)
{ {
int err; int err;
err = rpcb_create_local(); err = rpcb_create_local(&init_net);
if (err) if (err)
return err; return err;
@ -384,7 +384,7 @@ static int svc_rpcb_setup(struct svc_serv *serv)
void svc_rpcb_cleanup(struct svc_serv *serv) void svc_rpcb_cleanup(struct svc_serv *serv)
{ {
svc_unregister(serv); svc_unregister(serv);
rpcb_put_local(); rpcb_put_local(&init_net);
} }
EXPORT_SYMBOL_GPL(svc_rpcb_cleanup); EXPORT_SYMBOL_GPL(svc_rpcb_cleanup);