Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a289ce53 authored by Vasily Averin's avatar Vasily Averin Committed by J. Bruce Fields
Browse files

sunrpc: replace svc_serv->sv_bc_xprt by boolean flag



svc_serv-> sv_bc_xprt is netns-unsafe and cannot be used as pointer.
To prevent its misuse in future it is replaced by new boolean flag.

Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent d4b09acf
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -206,11 +206,13 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
		goto err_bind;
	}

	ret = -EPROTONOSUPPORT;
	ret = 0;
	if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0)
		ret = nfs4_callback_up_net(serv, net);
	else if (xprt->ops->bc_up)
		ret = xprt->ops->bc_up(serv, net);
	else if (xprt->ops->bc_setup)
		serv->sv_bc_enabled = true;
	else
		ret = -EPROTONOSUPPORT;

	if (ret < 0) {
		printk(KERN_ERR "NFS: callback service start failed\n");
+4 −6
Original line number Diff line number Diff line
@@ -47,11 +47,9 @@ void xprt_free_bc_rqst(struct rpc_rqst *req);
/*
 * Determine if a shared backchannel is in use
 */
static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
{
	if (rqstp->rq_server->sv_bc_xprt)
		return 1;
	return 0;
	return rqstp->rq_server->sv_bc_enabled;
}
#else /* CONFIG_SUNRPC_BACKCHANNEL */
static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
@@ -60,9 +58,9 @@ static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
	return 0;
}

static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
{
	return 0;
	return false;
}

static inline void xprt_free_bc_request(struct rpc_rqst *req)
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ struct svc_serv {
	spinlock_t		sv_cb_lock;	/* protects the svc_cb_list */
	wait_queue_head_t	sv_cb_waitq;	/* sleep here if there are no
						 * entries in the svc_cb_list */
	struct svc_xprt		*sv_bc_xprt;	/* callback on fore channel */
	bool			sv_bc_enabled;	/* service uses backchannel */
#endif /* CONFIG_SUNRPC_BACKCHANNEL */
};

+0 −2
Original line number Diff line number Diff line
@@ -1623,8 +1623,6 @@ static struct svc_xprt *svc_bc_create_socket(struct svc_serv *serv,
	svc_xprt_init(net, &svc_tcp_bc_class, xprt, serv);
	set_bit(XPT_CONG_CTRL, &svsk->sk_xprt.xpt_flags);

	serv->sv_bc_xprt = xprt;

	return xprt;
}

+0 −1
Original line number Diff line number Diff line
@@ -136,7 +136,6 @@ static struct svc_xprt *svc_rdma_bc_create(struct svc_serv *serv,

	svc_xprt_init(net, &svc_rdma_bc_class, xprt, serv);
	set_bit(XPT_CONG_CTRL, &xprt->xpt_flags);
	serv->sv_bc_xprt = xprt;

	dprintk("svcrdma: %s(%p)\n", __func__, xprt);
	return xprt;