Commit 0e1cb5c0 authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by Trond Myklebust

LockD: make NSM network namespace aware

NLM host is network namespace aware now.
So NSM have to take it into account.
Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 66697bfd
...@@ -62,14 +62,14 @@ static inline struct sockaddr *nsm_addr(const struct nsm_handle *nsm) ...@@ -62,14 +62,14 @@ static inline struct sockaddr *nsm_addr(const struct nsm_handle *nsm)
return (struct sockaddr *)&nsm->sm_addr; return (struct sockaddr *)&nsm->sm_addr;
} }
static struct rpc_clnt *nsm_create(void) static struct rpc_clnt *nsm_create(struct net *net)
{ {
struct sockaddr_in sin = { struct sockaddr_in sin = {
.sin_family = AF_INET, .sin_family = AF_INET,
.sin_addr.s_addr = htonl(INADDR_LOOPBACK), .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
}; };
struct rpc_create_args args = { struct rpc_create_args args = {
.net = &init_net, .net = net,
.protocol = XPRT_TRANSPORT_UDP, .protocol = XPRT_TRANSPORT_UDP,
.address = (struct sockaddr *)&sin, .address = (struct sockaddr *)&sin,
.addrsize = sizeof(sin), .addrsize = sizeof(sin),
...@@ -83,7 +83,8 @@ static struct rpc_clnt *nsm_create(void) ...@@ -83,7 +83,8 @@ static struct rpc_clnt *nsm_create(void)
return rpc_create(&args); return rpc_create(&args);
} }
static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res) static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res,
struct net *net)
{ {
struct rpc_clnt *clnt; struct rpc_clnt *clnt;
int status; int status;
...@@ -99,7 +100,7 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res) ...@@ -99,7 +100,7 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
.rpc_resp = res, .rpc_resp = res,
}; };
clnt = nsm_create(); clnt = nsm_create(net);
if (IS_ERR(clnt)) { if (IS_ERR(clnt)) {
status = PTR_ERR(clnt); status = PTR_ERR(clnt);
dprintk("lockd: failed to create NSM upcall transport, " dprintk("lockd: failed to create NSM upcall transport, "
...@@ -149,7 +150,7 @@ int nsm_monitor(const struct nlm_host *host) ...@@ -149,7 +150,7 @@ int nsm_monitor(const struct nlm_host *host)
*/ */
nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf; nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf;
status = nsm_mon_unmon(nsm, NSMPROC_MON, &res); status = nsm_mon_unmon(nsm, NSMPROC_MON, &res, host->net);
if (unlikely(res.status != 0)) if (unlikely(res.status != 0))
status = -EIO; status = -EIO;
if (unlikely(status < 0)) { if (unlikely(status < 0)) {
...@@ -183,7 +184,7 @@ void nsm_unmonitor(const struct nlm_host *host) ...@@ -183,7 +184,7 @@ void nsm_unmonitor(const struct nlm_host *host)
&& nsm->sm_monitored && !nsm->sm_sticky) { && nsm->sm_monitored && !nsm->sm_sticky) {
dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name); dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name);
status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res); status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res, host->net);
if (res.status != 0) if (res.status != 0)
status = -EIO; status = -EIO;
if (status < 0) if (status < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment