aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 18dc42eb5597..0ef4dd4414ec 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2375,16 +2375,6 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
2375 xprt->reestablish_timeout = 0; 2375 xprt->reestablish_timeout = 0;
2376 xprt->idle_timeout = 0; 2376 xprt->idle_timeout = 0;
2377 2377
2378 /*
2379 * The backchannel uses the same socket connection as the
2380 * forechannel
2381 */
2382 args->bc_xprt->xpt_bc_xprt = xprt;
2383 xprt->bc_xprt = args->bc_xprt;
2384 bc_sock = container_of(args->bc_xprt, struct svc_sock, sk_xprt);
2385 transport->sock = bc_sock->sk_sock;
2386 transport->inet = bc_sock->sk_sk;
2387
2388 xprt->ops = &bc_tcp_ops; 2378 xprt->ops = &bc_tcp_ops;
2389 2379
2390 switch (addr->sa_family) { 2380 switch (addr->sa_family) {
@@ -2407,6 +2397,29 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
2407 xprt->address_strings[RPC_DISPLAY_PROTO]); 2397 xprt->address_strings[RPC_DISPLAY_PROTO]);
2408 2398
2409 /* 2399 /*
2400 * The backchannel uses the same socket connection as the
2401 * forechannel
2402 */
2403 if (args->bc_xprt->xpt_bc_xprt) {
2404 /* XXX: actually, want to catch this case... */
2405 ret = ERR_PTR(-EINVAL);
2406 goto out_err;
2407 }
2408 /*
2409 * Once we've associated a backchannel xprt with a connection,
2410 * we want to keep it around as long as long as the connection
2411 * lasts, in case we need to start using it for a backchannel
2412 * again; this reference won't be dropped until bc_xprt is
2413 * destroyed.
2414 */
2415 xprt_get(xprt);
2416 args->bc_xprt->xpt_bc_xprt = xprt;
2417 xprt->bc_xprt = args->bc_xprt;
2418 bc_sock = container_of(args->bc_xprt, struct svc_sock, sk_xprt);
2419 transport->sock = bc_sock->sk_sock;
2420 transport->inet = bc_sock->sk_sk;
2421
2422 /*
2410 * Since we don't want connections for the backchannel, we set 2423 * Since we don't want connections for the backchannel, we set
2411 * the xprt status to connected 2424 * the xprt status to connected
2412 */ 2425 */
@@ -2415,6 +2428,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
2415 2428
2416 if (try_module_get(THIS_MODULE)) 2429 if (try_module_get(THIS_MODULE))
2417 return xprt; 2430 return xprt;
2431 xprt_put(xprt);
2418 ret = ERR_PTR(-EINVAL); 2432 ret = ERR_PTR(-EINVAL);
2419out_err: 2433out_err:
2420 xprt_free(xprt); 2434 xprt_free(xprt);