summaryrefslogtreecommitdiff
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2016-05-17 19:38:21 +0300
committerJ. Bruce Fields <bfields@redhat.com>2016-06-15 17:32:25 +0300
commit39a9beab5acb83176e8b9a4f0778749a09341f1f (patch)
tree0b261e618de1605fd80eb68bd277ff0d95eef476 /net/sunrpc/clnt.c
parentd50039ea5ee63c589b0434baa5ecf6e5075bb6f9 (diff)
downloadlinux-39a9beab5acb83176e8b9a4f0778749a09341f1f.tar.xz
rpc: share one xps between all backchannels
The spec allows backchannels for multiple clients to share the same tcp connection. When that happens, we need to use the same xprt for all of them. Similarly, we need the same xps. This fixes list corruption introduced by the multipath code. Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com> Acked-by: Trond Myklebust <trondmy@primarydata.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index b33721d41adc..2808d550d273 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -452,10 +452,20 @@ static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
struct rpc_clnt *clnt = NULL;
struct rpc_xprt_switch *xps;
- xps = xprt_switch_alloc(xprt, GFP_KERNEL);
- if (xps == NULL) {
- xprt_put(xprt);
- return ERR_PTR(-ENOMEM);
+ if (args->bc_xprt && args->bc_xprt->xpt_bc_xps) {
+ WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP);
+ xps = args->bc_xprt->xpt_bc_xps;
+ xprt_switch_get(xps);
+ } else {
+ xps = xprt_switch_alloc(xprt, GFP_KERNEL);
+ if (xps == NULL) {
+ xprt_put(xprt);
+ return ERR_PTR(-ENOMEM);
+ }
+ if (xprt->bc_xprt) {
+ xprt_switch_get(xps);
+ xprt->bc_xprt->xpt_bc_xps = xps;
+ }
}
clnt = rpc_new_client(args, xps, xprt, NULL);
if (IS_ERR(clnt))