aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-08 21:28:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-08 21:28:14 -0400
commit75ff24fa52f0cc512ceee4c377632b91a3a80811 (patch)
tree1b4a7a17c203221afb12027834c62679017655bb /net/sunrpc
parent0f386a7074aa758720a4fc1fa26123044849bcc6 (diff)
parent06f9cc12caa862f5bc86ebdb4f77568a4bef0167 (diff)
Merge branch 'for-3.15' of git://linux-nfs.org/~bfields/linux
Pull nfsd updates from Bruce Fields: "Highlights: - server-side nfs/rdma fixes from Jeff Layton and Tom Tucker - xdr fixes (a larger xdr rewrite has been posted but I decided it would be better to queue it up for 3.16). - miscellaneous fixes and cleanup from all over (thanks especially to Kinglong Mee)" * 'for-3.15' of git://linux-nfs.org/~bfields/linux: (36 commits) nfsd4: don't create unnecessary mask acl nfsd: revert v2 half of "nfsd: don't return high mode bits" nfsd4: fix memory leak in nfsd4_encode_fattr() nfsd: check passed socket's net matches NFSd superblock's one SUNRPC: Clear xpt_bc_xprt if xs_setup_bc_tcp failed NFSD/SUNRPC: Check rpc_xprt out of xs_setup_bc_tcp SUNRPC: New helper for creating client with rpc_xprt NFSD: Free backchannel xprt in bc_destroy NFSD: Clear wcc data between compound ops nfsd: Don't return NFS4ERR_STALE_STATEID for NFSv4.1+ nfsd4: fix nfs4err_resource in 4.1 case nfsd4: fix setclientid encode size nfsd4: remove redundant check from nfsd4_check_resp_size nfsd4: use more generous NFS4_ACL_MAX nfsd4: minor nfsd4_replay_cache_entry cleanup nfsd4: nfsd4_replay_cache_entry should be static nfsd4: update comments with obsolete function name rpc: Allow xdr_buf_subsegment to operate in-place NFSD: Using free_conn free connection SUNRPC: fix memory leak of peer addresses in XPRT ...
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/Kconfig39
-rw-r--r--net/sunrpc/Makefile3
-rw-r--r--net/sunrpc/clnt.c58
-rw-r--r--net/sunrpc/svcsock.c16
-rw-r--r--net/sunrpc/xdr.c22
-rw-r--r--net/sunrpc/xprt.c12
-rw-r--r--net/sunrpc/xprtrdma/Makefile4
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c12
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c2
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c3
-rw-r--r--net/sunrpc/xprtsock.c34
11 files changed, 119 insertions, 86 deletions
diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig
index 241b54f30204..0754d0f466d2 100644
--- a/net/sunrpc/Kconfig
+++ b/net/sunrpc/Kconfig
@@ -9,19 +9,6 @@ config SUNRPC_BACKCHANNEL
9 bool 9 bool
10 depends on SUNRPC 10 depends on SUNRPC
11 11
12config SUNRPC_XPRT_RDMA
13 tristate
14 depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS
15 default SUNRPC && INFINIBAND
16 help
17 This option allows the NFS client and server to support
18 an RDMA-enabled transport.
19
20 To compile RPC client RDMA transport support as a module,
21 choose M here: the module will be called xprtrdma.
22
23 If unsure, say N.
24
25config SUNRPC_SWAP 12config SUNRPC_SWAP
26 bool 13 bool
27 depends on SUNRPC 14 depends on SUNRPC
@@ -57,3 +44,29 @@ config SUNRPC_DEBUG
57 but makes troubleshooting NFS issues significantly harder. 44 but makes troubleshooting NFS issues significantly harder.
58 45
59 If unsure, say Y. 46 If unsure, say Y.
47
48config SUNRPC_XPRT_RDMA_CLIENT
49 tristate "RPC over RDMA Client Support"
50 depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS
51 default SUNRPC && INFINIBAND
52 help
53 This option allows the NFS client to support an RDMA-enabled
54 transport.
55
56 To compile RPC client RDMA transport support as a module,
57 choose M here: the module will be called xprtrdma.
58
59 If unsure, say N.
60
61config SUNRPC_XPRT_RDMA_SERVER
62 tristate "RPC over RDMA Server Support"
63 depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS
64 default SUNRPC && INFINIBAND
65 help
66 This option allows the NFS server to support an RDMA-enabled
67 transport.
68
69 To compile RPC server RDMA transport support as a module,
70 choose M here: the module will be called svcrdma.
71
72 If unsure, say N.
diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile
index 8209a0411bca..e5a7a1cac8f3 100644
--- a/net/sunrpc/Makefile
+++ b/net/sunrpc/Makefile
@@ -5,7 +5,8 @@
5 5
6obj-$(CONFIG_SUNRPC) += sunrpc.o 6obj-$(CONFIG_SUNRPC) += sunrpc.o
7obj-$(CONFIG_SUNRPC_GSS) += auth_gss/ 7obj-$(CONFIG_SUNRPC_GSS) += auth_gss/
8obj-$(CONFIG_SUNRPC_XPRT_RDMA) += xprtrdma/ 8
9obj-y += xprtrdma/
9 10
10sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \ 11sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
11 auth.o auth_null.o auth_unix.o auth_generic.o \ 12 auth.o auth_null.o auth_unix.o auth_generic.o \
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index f400445d1a44..2e6ab10734f6 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -438,6 +438,38 @@ out_no_rpciod:
438 return ERR_PTR(err); 438 return ERR_PTR(err);
439} 439}
440 440
441struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
442 struct rpc_xprt *xprt)
443{
444 struct rpc_clnt *clnt = NULL;
445
446 clnt = rpc_new_client(args, xprt, NULL);
447 if (IS_ERR(clnt))
448 return clnt;
449
450 if (!(args->flags & RPC_CLNT_CREATE_NOPING)) {
451 int err = rpc_ping(clnt);
452 if (err != 0) {
453 rpc_shutdown_client(clnt);
454 return ERR_PTR(err);
455 }
456 }
457
458 clnt->cl_softrtry = 1;
459 if (args->flags & RPC_CLNT_CREATE_HARDRTRY)
460 clnt->cl_softrtry = 0;
461
462 if (args->flags & RPC_CLNT_CREATE_AUTOBIND)
463 clnt->cl_autobind = 1;
464 if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
465 clnt->cl_discrtry = 1;
466 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
467 clnt->cl_chatty = 1;
468
469 return clnt;
470}
471EXPORT_SYMBOL_GPL(rpc_create_xprt);
472
441/** 473/**
442 * rpc_create - create an RPC client and transport with one call 474 * rpc_create - create an RPC client and transport with one call
443 * @args: rpc_clnt create argument structure 475 * @args: rpc_clnt create argument structure
@@ -451,7 +483,6 @@ out_no_rpciod:
451struct rpc_clnt *rpc_create(struct rpc_create_args *args) 483struct rpc_clnt *rpc_create(struct rpc_create_args *args)
452{ 484{
453 struct rpc_xprt *xprt; 485 struct rpc_xprt *xprt;
454 struct rpc_clnt *clnt;
455 struct xprt_create xprtargs = { 486 struct xprt_create xprtargs = {
456 .net = args->net, 487 .net = args->net,
457 .ident = args->protocol, 488 .ident = args->protocol,
@@ -515,30 +546,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
515 if (args->flags & RPC_CLNT_CREATE_NONPRIVPORT) 546 if (args->flags & RPC_CLNT_CREATE_NONPRIVPORT)
516 xprt->resvport = 0; 547 xprt->resvport = 0;
517 548
518 clnt = rpc_new_client(args, xprt, NULL); 549 return rpc_create_xprt(args, xprt);
519 if (IS_ERR(clnt))
520 return clnt;
521
522 if (!(args->flags & RPC_CLNT_CREATE_NOPING)) {
523 int err = rpc_ping(clnt);
524 if (err != 0) {
525 rpc_shutdown_client(clnt);
526 return ERR_PTR(err);
527 }
528 }
529
530 clnt->cl_softrtry = 1;
531 if (args->flags & RPC_CLNT_CREATE_HARDRTRY)
532 clnt->cl_softrtry = 0;
533
534 if (args->flags & RPC_CLNT_CREATE_AUTOBIND)
535 clnt->cl_autobind = 1;
536 if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
537 clnt->cl_discrtry = 1;
538 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
539 clnt->cl_chatty = 1;
540
541 return clnt;
542} 550}
543EXPORT_SYMBOL_GPL(rpc_create); 551EXPORT_SYMBOL_GPL(rpc_create);
544 552
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index b6e59f0a9475..d06cb8752dcd 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1397,6 +1397,22 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
1397 return svsk; 1397 return svsk;
1398} 1398}
1399 1399
1400bool svc_alien_sock(struct net *net, int fd)
1401{
1402 int err;
1403 struct socket *sock = sockfd_lookup(fd, &err);
1404 bool ret = false;
1405
1406 if (!sock)
1407 goto out;
1408 if (sock_net(sock->sk) != net)
1409 ret = true;
1410 sockfd_put(sock);
1411out:
1412 return ret;
1413}
1414EXPORT_SYMBOL_GPL(svc_alien_sock);
1415
1400/** 1416/**
1401 * svc_addsock - add a listener socket to an RPC service 1417 * svc_addsock - add a listener socket to an RPC service
1402 * @serv: pointer to RPC service to which to add a new listener 1418 * @serv: pointer to RPC service to which to add a new listener
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 1504bb11e4f3..dd97ba3c4456 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -833,8 +833,20 @@ xdr_buf_from_iov(struct kvec *iov, struct xdr_buf *buf)
833} 833}
834EXPORT_SYMBOL_GPL(xdr_buf_from_iov); 834EXPORT_SYMBOL_GPL(xdr_buf_from_iov);
835 835
836/* Sets subbuf to the portion of buf of length len beginning base bytes 836/**
837 * from the start of buf. Returns -1 if base of length are out of bounds. */ 837 * xdr_buf_subsegment - set subbuf to a portion of buf
838 * @buf: an xdr buffer
839 * @subbuf: the result buffer
840 * @base: beginning of range in bytes
841 * @len: length of range in bytes
842 *
843 * sets @subbuf to an xdr buffer representing the portion of @buf of
844 * length @len starting at offset @base.
845 *
846 * @buf and @subbuf may be pointers to the same struct xdr_buf.
847 *
848 * Returns -1 if base of length are out of bounds.
849 */
838int 850int
839xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf, 851xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
840 unsigned int base, unsigned int len) 852 unsigned int base, unsigned int len)
@@ -847,9 +859,8 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
847 len -= subbuf->head[0].iov_len; 859 len -= subbuf->head[0].iov_len;
848 base = 0; 860 base = 0;
849 } else { 861 } else {
850 subbuf->head[0].iov_base = NULL;
851 subbuf->head[0].iov_len = 0;
852 base -= buf->head[0].iov_len; 862 base -= buf->head[0].iov_len;
863 subbuf->head[0].iov_len = 0;
853 } 864 }
854 865
855 if (base < buf->page_len) { 866 if (base < buf->page_len) {
@@ -871,9 +882,8 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
871 len -= subbuf->tail[0].iov_len; 882 len -= subbuf->tail[0].iov_len;
872 base = 0; 883 base = 0;
873 } else { 884 } else {
874 subbuf->tail[0].iov_base = NULL;
875 subbuf->tail[0].iov_len = 0;
876 base -= buf->tail[0].iov_len; 885 base -= buf->tail[0].iov_len;
886 subbuf->tail[0].iov_len = 0;
877 } 887 }
878 888
879 if (base || len) 889 if (base || len)
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 7d4df99f761f..d173f79947c6 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1383,15 +1383,3 @@ void xprt_put(struct rpc_xprt *xprt)
1383 if (atomic_dec_and_test(&xprt->count)) 1383 if (atomic_dec_and_test(&xprt->count))
1384 xprt_destroy(xprt); 1384 xprt_destroy(xprt);
1385} 1385}
1386
1387/**
1388 * xprt_get - return a reference to an RPC transport.
1389 * @xprt: pointer to the transport
1390 *
1391 */
1392struct rpc_xprt *xprt_get(struct rpc_xprt *xprt)
1393{
1394 if (atomic_inc_not_zero(&xprt->count))
1395 return xprt;
1396 return NULL;
1397}
diff --git a/net/sunrpc/xprtrdma/Makefile b/net/sunrpc/xprtrdma/Makefile
index 5a8f268bdd30..da5136fd5694 100644
--- a/net/sunrpc/xprtrdma/Makefile
+++ b/net/sunrpc/xprtrdma/Makefile
@@ -1,8 +1,8 @@
1obj-$(CONFIG_SUNRPC_XPRT_RDMA) += xprtrdma.o 1obj-$(CONFIG_SUNRPC_XPRT_RDMA_CLIENT) += xprtrdma.o
2 2
3xprtrdma-y := transport.o rpc_rdma.o verbs.o 3xprtrdma-y := transport.o rpc_rdma.o verbs.o
4 4
5obj-$(CONFIG_SUNRPC_XPRT_RDMA) += svcrdma.o 5obj-$(CONFIG_SUNRPC_XPRT_RDMA_SERVER) += svcrdma.o
6 6
7svcrdma-y := svc_rdma.o svc_rdma_transport.o \ 7svcrdma-y := svc_rdma.o svc_rdma_transport.o \
8 svc_rdma_marshal.o svc_rdma_sendto.o svc_rdma_recvfrom.o 8 svc_rdma_marshal.o svc_rdma_sendto.o svc_rdma_recvfrom.o
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index 0ce75524ed21..8d904e4eef15 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -90,6 +90,7 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,
90 sge_no++; 90 sge_no++;
91 } 91 }
92 rqstp->rq_respages = &rqstp->rq_pages[sge_no]; 92 rqstp->rq_respages = &rqstp->rq_pages[sge_no];
93 rqstp->rq_next_page = rqstp->rq_respages + 1;
93 94
94 /* We should never run out of SGE because the limit is defined to 95 /* We should never run out of SGE because the limit is defined to
95 * support the max allowed RPC data length 96 * support the max allowed RPC data length
@@ -169,6 +170,7 @@ static int map_read_chunks(struct svcxprt_rdma *xprt,
169 */ 170 */
170 head->arg.pages[page_no] = rqstp->rq_arg.pages[page_no]; 171 head->arg.pages[page_no] = rqstp->rq_arg.pages[page_no];
171 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no+1]; 172 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no+1];
173 rqstp->rq_next_page = rqstp->rq_respages + 1;
172 174
173 byte_count -= sge_bytes; 175 byte_count -= sge_bytes;
174 ch_bytes -= sge_bytes; 176 ch_bytes -= sge_bytes;
@@ -276,6 +278,7 @@ static int fast_reg_read_chunks(struct svcxprt_rdma *xprt,
276 278
277 /* rq_respages points one past arg pages */ 279 /* rq_respages points one past arg pages */
278 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no]; 280 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no];
281 rqstp->rq_next_page = rqstp->rq_respages + 1;
279 282
280 /* Create the reply and chunk maps */ 283 /* Create the reply and chunk maps */
281 offset = 0; 284 offset = 0;
@@ -520,13 +523,6 @@ next_sge:
520 for (ch_no = 0; &rqstp->rq_pages[ch_no] < rqstp->rq_respages; ch_no++) 523 for (ch_no = 0; &rqstp->rq_pages[ch_no] < rqstp->rq_respages; ch_no++)
521 rqstp->rq_pages[ch_no] = NULL; 524 rqstp->rq_pages[ch_no] = NULL;
522 525
523 /*
524 * Detach res pages. If svc_release sees any it will attempt to
525 * put them.
526 */
527 while (rqstp->rq_next_page != rqstp->rq_respages)
528 *(--rqstp->rq_next_page) = NULL;
529
530 return err; 526 return err;
531} 527}
532 528
@@ -550,7 +546,7 @@ static int rdma_read_complete(struct svc_rqst *rqstp,
550 546
551 /* rq_respages starts after the last arg page */ 547 /* rq_respages starts after the last arg page */
552 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no]; 548 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no];
553 rqstp->rq_next_page = &rqstp->rq_arg.pages[page_no]; 549 rqstp->rq_next_page = rqstp->rq_respages + 1;
554 550
555 /* Rebuild rq_arg head and tail. */ 551 /* Rebuild rq_arg head and tail. */
556 rqstp->rq_arg.head[0] = head->arg.head[0]; 552 rqstp->rq_arg.head[0] = head->arg.head[0];
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index c1d124dc772b..7e024a51617e 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -265,6 +265,7 @@ static dma_addr_t dma_map_xdr(struct svcxprt_rdma *xprt,
265 xdr_off -= xdr->head[0].iov_len; 265 xdr_off -= xdr->head[0].iov_len;
266 if (xdr_off < xdr->page_len) { 266 if (xdr_off < xdr->page_len) {
267 /* This offset is in the page list */ 267 /* This offset is in the page list */
268 xdr_off += xdr->page_base;
268 page = xdr->pages[xdr_off >> PAGE_SHIFT]; 269 page = xdr->pages[xdr_off >> PAGE_SHIFT];
269 xdr_off &= ~PAGE_MASK; 270 xdr_off &= ~PAGE_MASK;
270 } else { 271 } else {
@@ -625,6 +626,7 @@ static int send_reply(struct svcxprt_rdma *rdma,
625 if (page_no+1 >= sge_no) 626 if (page_no+1 >= sge_no)
626 ctxt->sge[page_no+1].length = 0; 627 ctxt->sge[page_no+1].length = 0;
627 } 628 }
629 rqstp->rq_next_page = rqstp->rq_respages + 1;
628 BUG_ON(sge_no > rdma->sc_max_sge); 630 BUG_ON(sge_no > rdma->sc_max_sge);
629 memset(&send_wr, 0, sizeof send_wr); 631 memset(&send_wr, 0, sizeof send_wr);
630 ctxt->wr_op = IB_WR_SEND; 632 ctxt->wr_op = IB_WR_SEND;
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 62e4f9bcc387..25688fa2207f 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -477,8 +477,7 @@ struct page *svc_rdma_get_page(void)
477 477
478 while ((page = alloc_page(GFP_KERNEL)) == NULL) { 478 while ((page = alloc_page(GFP_KERNEL)) == NULL) {
479 /* If we can't get memory, wait a bit and try again */ 479 /* If we can't get memory, wait a bit and try again */
480 printk(KERN_INFO "svcrdma: out of memory...retrying in 1000 " 480 printk(KERN_INFO "svcrdma: out of memory...retrying in 1s\n");
481 "jiffies.\n");
482 schedule_timeout_uninterruptible(msecs_to_jiffies(1000)); 481 schedule_timeout_uninterruptible(msecs_to_jiffies(1000));
483 } 482 }
484 return page; 483 return page;
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 966763d735e9..6735e1d1e9bb 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -909,6 +909,12 @@ static void xs_tcp_close(struct rpc_xprt *xprt)
909 xs_tcp_shutdown(xprt); 909 xs_tcp_shutdown(xprt);
910} 910}
911 911
912static void xs_xprt_free(struct rpc_xprt *xprt)
913{
914 xs_free_peer_addresses(xprt);
915 xprt_free(xprt);
916}
917
912/** 918/**
913 * xs_destroy - prepare to shutdown a transport 919 * xs_destroy - prepare to shutdown a transport
914 * @xprt: doomed transport 920 * @xprt: doomed transport
@@ -919,8 +925,7 @@ static void xs_destroy(struct rpc_xprt *xprt)
919 dprintk("RPC: xs_destroy xprt %p\n", xprt); 925 dprintk("RPC: xs_destroy xprt %p\n", xprt);
920 926
921 xs_close(xprt); 927 xs_close(xprt);
922 xs_free_peer_addresses(xprt); 928 xs_xprt_free(xprt);
923 xprt_free(xprt);
924 module_put(THIS_MODULE); 929 module_put(THIS_MODULE);
925} 930}
926 931
@@ -2532,6 +2537,10 @@ static void bc_close(struct rpc_xprt *xprt)
2532 2537
2533static void bc_destroy(struct rpc_xprt *xprt) 2538static void bc_destroy(struct rpc_xprt *xprt)
2534{ 2539{
2540 dprintk("RPC: bc_destroy xprt %p\n", xprt);
2541
2542 xs_xprt_free(xprt);
2543 module_put(THIS_MODULE);
2535} 2544}
2536 2545
2537static struct rpc_xprt_ops xs_local_ops = { 2546static struct rpc_xprt_ops xs_local_ops = {
@@ -2732,7 +2741,7 @@ static struct rpc_xprt *xs_setup_local(struct xprt_create *args)
2732 return xprt; 2741 return xprt;
2733 ret = ERR_PTR(-EINVAL); 2742 ret = ERR_PTR(-EINVAL);
2734out_err: 2743out_err:
2735 xprt_free(xprt); 2744 xs_xprt_free(xprt);
2736 return ret; 2745 return ret;
2737} 2746}
2738 2747
@@ -2810,7 +2819,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
2810 return xprt; 2819 return xprt;
2811 ret = ERR_PTR(-EINVAL); 2820 ret = ERR_PTR(-EINVAL);
2812out_err: 2821out_err:
2813 xprt_free(xprt); 2822 xs_xprt_free(xprt);
2814 return ret; 2823 return ret;
2815} 2824}
2816 2825
@@ -2885,12 +2894,11 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
2885 xprt->address_strings[RPC_DISPLAY_ADDR], 2894 xprt->address_strings[RPC_DISPLAY_ADDR],
2886 xprt->address_strings[RPC_DISPLAY_PROTO]); 2895 xprt->address_strings[RPC_DISPLAY_PROTO]);
2887 2896
2888
2889 if (try_module_get(THIS_MODULE)) 2897 if (try_module_get(THIS_MODULE))
2890 return xprt; 2898 return xprt;
2891 ret = ERR_PTR(-EINVAL); 2899 ret = ERR_PTR(-EINVAL);
2892out_err: 2900out_err:
2893 xprt_free(xprt); 2901 xs_xprt_free(xprt);
2894 return ret; 2902 return ret;
2895} 2903}
2896 2904
@@ -2907,15 +2915,6 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
2907 struct svc_sock *bc_sock; 2915 struct svc_sock *bc_sock;
2908 struct rpc_xprt *ret; 2916 struct rpc_xprt *ret;
2909 2917
2910 if (args->bc_xprt->xpt_bc_xprt) {
2911 /*
2912 * This server connection already has a backchannel
2913 * transport; we can't create a new one, as we wouldn't
2914 * be able to match replies based on xid any more. So,
2915 * reuse the already-existing one:
2916 */
2917 return args->bc_xprt->xpt_bc_xprt;
2918 }
2919 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries, 2918 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries,
2920 xprt_tcp_slot_table_entries); 2919 xprt_tcp_slot_table_entries);
2921 if (IS_ERR(xprt)) 2920 if (IS_ERR(xprt))
@@ -2973,13 +2972,14 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
2973 */ 2972 */
2974 xprt_set_connected(xprt); 2973 xprt_set_connected(xprt);
2975 2974
2976
2977 if (try_module_get(THIS_MODULE)) 2975 if (try_module_get(THIS_MODULE))
2978 return xprt; 2976 return xprt;
2977
2978 args->bc_xprt->xpt_bc_xprt = NULL;
2979 xprt_put(xprt); 2979 xprt_put(xprt);
2980 ret = ERR_PTR(-EINVAL); 2980 ret = ERR_PTR(-EINVAL);
2981out_err: 2981out_err:
2982 xprt_free(xprt); 2982 xs_xprt_free(xprt);
2983 return ret; 2983 return ret;
2984} 2984}
2985 2985