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>
This commit is contained in:
parent
94cf3179cc
commit
bd4620ddf6
|
@ -109,7 +109,7 @@ static inline int register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u
|
|||
|
||||
int svc_reg_xprt_class(struct svc_xprt_class *);
|
||||
void svc_unreg_xprt_class(struct svc_xprt_class *);
|
||||
void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
|
||||
void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
|
||||
struct svc_serv *);
|
||||
int svc_create_xprt(struct svc_serv *, const char *, struct net *,
|
||||
const int, const unsigned short, int);
|
||||
|
|
|
@ -148,8 +148,8 @@ EXPORT_SYMBOL_GPL(svc_xprt_put);
|
|||
* Called by transport drivers to initialize the transport independent
|
||||
* portion of the transport instance.
|
||||
*/
|
||||
void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt,
|
||||
struct svc_serv *serv)
|
||||
void svc_xprt_init(struct net *net, struct svc_xprt_class *xcl,
|
||||
struct svc_xprt *xprt, struct svc_serv *serv)
|
||||
{
|
||||
memset(xprt, 0, sizeof(*xprt));
|
||||
xprt->xpt_class = xcl;
|
||||
|
@ -164,7 +164,7 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt,
|
|||
spin_lock_init(&xprt->xpt_lock);
|
||||
set_bit(XPT_BUSY, &xprt->xpt_flags);
|
||||
rpc_init_wait_queue(&xprt->xpt_bc_pending, "xpt_bc_pending");
|
||||
xprt->xpt_net = get_net(&init_net);
|
||||
xprt->xpt_net = get_net(net);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(svc_xprt_init);
|
||||
|
||||
|
|
|
@ -739,7 +739,8 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
|
|||
{
|
||||
int err, level, optname, one = 1;
|
||||
|
||||
svc_xprt_init(&svc_udp_class, &svsk->sk_xprt, serv);
|
||||
svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_udp_class,
|
||||
&svsk->sk_xprt, serv);
|
||||
clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags);
|
||||
svsk->sk_sk->sk_data_ready = svc_udp_data_ready;
|
||||
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)
|
|||
{
|
||||
struct sock *sk = svsk->sk_sk;
|
||||
|
||||
svc_xprt_init(&svc_tcp_class, &svsk->sk_xprt, serv);
|
||||
svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_tcp_class,
|
||||
&svsk->sk_xprt, serv);
|
||||
set_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags);
|
||||
if (sk->sk_state == TCP_LISTEN) {
|
||||
dprintk("setting up TCP socket for listening\n");
|
||||
|
@ -1659,7 +1661,7 @@ static struct svc_xprt *svc_bc_create_socket(struct svc_serv *serv,
|
|||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
xprt = &svsk->sk_xprt;
|
||||
svc_xprt_init(&svc_tcp_bc_class, xprt, serv);
|
||||
svc_xprt_init(net, &svc_tcp_bc_class, xprt, serv);
|
||||
|
||||
serv->sv_bc_xprt = xprt;
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv,
|
|||
|
||||
if (!cma_xprt)
|
||||
return NULL;
|
||||
svc_xprt_init(&svc_rdma_class, &cma_xprt->sc_xprt, serv);
|
||||
svc_xprt_init(&init_net, &svc_rdma_class, &cma_xprt->sc_xprt, serv);
|
||||
INIT_LIST_HEAD(&cma_xprt->sc_accept_q);
|
||||
INIT_LIST_HEAD(&cma_xprt->sc_dto_q);
|
||||
INIT_LIST_HEAD(&cma_xprt->sc_rq_dto_q);
|
||||
|
|
Loading…
Reference in a new issue