aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2015-01-13 11:03:11 -0500
committerJ. Bruce Fields <bfields@redhat.com>2015-01-15 15:01:45 -0500
commite5523bd28101869c85856247fc120faaf72bd232 (patch)
treee7a485eb027f66d2a17c67b53fd7dd50a77a4e36
parent3fe04ee9f91084e7e6e999b09b8b15bcf97375e8 (diff)
svcrdma: Find rmsgp more reliably
xdr_start() can return the wrong rmsgp address if an assumption about how the xdr_buf was constructed changes. When it gets it wrong, the client receives a reply that has gibberish in the RPC/RDMA header, preventing it from matching a waiting RPC request. Instead, make (and document) just one assumption: that the RDMA header for the client's RPC call is at the start of the first page in rq_pages. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 7d79897959a4..7de33d1af9b6 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -483,18 +483,6 @@ void svc_rdma_prep_reply_hdr(struct svc_rqst *rqstp)
483{ 483{
484} 484}
485 485
486/*
487 * Return the start of an xdr buffer.
488 */
489static void *xdr_start(struct xdr_buf *xdr)
490{
491 return xdr->head[0].iov_base -
492 (xdr->len -
493 xdr->page_len -
494 xdr->tail[0].iov_len -
495 xdr->head[0].iov_len);
496}
497
498int svc_rdma_sendto(struct svc_rqst *rqstp) 486int svc_rdma_sendto(struct svc_rqst *rqstp)
499{ 487{
500 struct svc_xprt *xprt = rqstp->rq_xprt; 488 struct svc_xprt *xprt = rqstp->rq_xprt;
@@ -512,8 +500,10 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
512 500
513 dprintk("svcrdma: sending response for rqstp=%p\n", rqstp); 501 dprintk("svcrdma: sending response for rqstp=%p\n", rqstp);
514 502
515 /* Get the RDMA request header. */ 503 /* Get the RDMA request header. The receive logic always
516 rdma_argp = xdr_start(&rqstp->rq_arg); 504 * places this at the start of page 0.
505 */
506 rdma_argp = page_address(rqstp->rq_pages[0]);
517 507
518 /* Build an req vec for the XDR */ 508 /* Build an req vec for the XDR */
519 ctxt = svc_rdma_get_context(rdma); 509 ctxt = svc_rdma_get_context(rdma);