aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2011-12-06 06:19:10 -0500
committerJ. Bruce Fields <bfields@redhat.com>2011-12-06 16:20:42 -0500
commitbd4620ddf6d6eb3d9e7d073ad601fa4299d46ba9 (patch)
tree26625283079a642b4241b7b75482a0a558dd5ca9 /net/sunrpc
parent94cf3179ccfc69d727dd884fd0831d82ada6bb06 (diff)
SUNRPC: create svc_xprt in proper network namespace
This patch makes svc_xprt inherit network namespace link from its socket. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/svc_xprt.c6
-rw-r--r--net/sunrpc/svcsock.c8
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c2
3 files changed, 9 insertions, 7 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 0d80c064e634..0633c7e2fe63 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -148,8 +148,8 @@ EXPORT_SYMBOL_GPL(svc_xprt_put);
148 * Called by transport drivers to initialize the transport independent 148 * Called by transport drivers to initialize the transport independent
149 * portion of the transport instance. 149 * portion of the transport instance.
150 */ 150 */
151void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt, 151void svc_xprt_init(struct net *net, struct svc_xprt_class *xcl,
152 struct svc_serv *serv) 152 struct svc_xprt *xprt, struct svc_serv *serv)
153{ 153{
154 memset(xprt, 0, sizeof(*xprt)); 154 memset(xprt, 0, sizeof(*xprt));
155 xprt->xpt_class = xcl; 155 xprt->xpt_class = xcl;
@@ -164,7 +164,7 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt,
164 spin_lock_init(&xprt->xpt_lock); 164 spin_lock_init(&xprt->xpt_lock);
165 set_bit(XPT_BUSY, &xprt->xpt_flags); 165 set_bit(XPT_BUSY, &xprt->xpt_flags);
166 rpc_init_wait_queue(&xprt->xpt_bc_pending, "xpt_bc_pending"); 166 rpc_init_wait_queue(&xprt->xpt_bc_pending, "xpt_bc_pending");
167 xprt->xpt_net = get_net(&init_net); 167 xprt->xpt_net = get_net(net);
168} 168}
169EXPORT_SYMBOL_GPL(svc_xprt_init); 169EXPORT_SYMBOL_GPL(svc_xprt_init);
170 170
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 71bed1c1c77a..277909e651ed 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -739,7 +739,8 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
739{ 739{
740 int err, level, optname, one = 1; 740 int err, level, optname, one = 1;
741 741
742 svc_xprt_init(&svc_udp_class, &svsk->sk_xprt, serv); 742 svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_udp_class,
743 &svsk->sk_xprt, serv);
743 clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags); 744 clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags);
744 svsk->sk_sk->sk_data_ready = svc_udp_data_ready; 745 svsk->sk_sk->sk_data_ready = svc_udp_data_ready;
745 svsk->sk_sk->sk_write_space = svc_write_space; 746 svsk->sk_sk->sk_write_space = svc_write_space;
@@ -1343,7 +1344,8 @@ static void svc_tcp_init(struct svc_sock *svsk, struct svc_serv *serv)
1343{ 1344{
1344 struct sock *sk = svsk->sk_sk; 1345 struct sock *sk = svsk->sk_sk;
1345 1346
1346 svc_xprt_init(&svc_tcp_class, &svsk->sk_xprt, serv); 1347 svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_tcp_class,
1348 &svsk->sk_xprt, serv);
1347 set_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags); 1349 set_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags);
1348 if (sk->sk_state == TCP_LISTEN) { 1350 if (sk->sk_state == TCP_LISTEN) {
1349 dprintk("setting up TCP socket for listening\n"); 1351 dprintk("setting up TCP socket for listening\n");
@@ -1659,7 +1661,7 @@ static struct svc_xprt *svc_bc_create_socket(struct svc_serv *serv,
1659 return ERR_PTR(-ENOMEM); 1661 return ERR_PTR(-ENOMEM);
1660 1662
1661 xprt = &svsk->sk_xprt; 1663 xprt = &svsk->sk_xprt;
1662 svc_xprt_init(&svc_tcp_bc_class, xprt, serv); 1664 svc_xprt_init(net, &svc_tcp_bc_class, xprt, serv);
1663 1665
1664 serv->sv_bc_xprt = xprt; 1666 serv->sv_bc_xprt = xprt;
1665 1667
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index ba1296d88de0..894cb42db91d 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -453,7 +453,7 @@ static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv,
453 453
454 if (!cma_xprt) 454 if (!cma_xprt)
455 return NULL; 455 return NULL;
456 svc_xprt_init(&svc_rdma_class, &cma_xprt->sc_xprt, serv); 456 svc_xprt_init(&init_net, &svc_rdma_class, &cma_xprt->sc_xprt, serv);
457 INIT_LIST_HEAD(&cma_xprt->sc_accept_q); 457 INIT_LIST_HEAD(&cma_xprt->sc_accept_q);
458 INIT_LIST_HEAD(&cma_xprt->sc_dto_q); 458 INIT_LIST_HEAD(&cma_xprt->sc_dto_q);
459 INIT_LIST_HEAD(&cma_xprt->sc_rq_dto_q); 459 INIT_LIST_HEAD(&cma_xprt->sc_rq_dto_q);