Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1254867

[PATCH 4.2 54/54] svcrdma: handle rdma read with a non-zero initial page offset

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.2 54/54] svcrdma: handle rdma read with a non-zero initial page offset
Date 2015-10-23 20:30 +0200
Message-ID <qmPgf-112-49@gated-at.bofh.it> (permalink)
References <qmODw-8sm-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steve Wise <swise@opengridcomputing.com>

commit c91aed9896946721bb30705ea2904edb3725dd61 upstream.

The server rdma_read_chunk_lcl() and rdma_read_chunk_frmr() functions
were not taking into account the initial page_offset when determining
the rdma read length.  This resulted in a read who's starting address
and length exceeded the base/bounds of the frmr.

The server gets an async error from the rdma device and kills the
connection, and the client then reconnects and resends.  This repeats
indefinitely, and the application hangs.

Most work loads don't tickle this bug apparently, but one test hit it
every time: building the linux kernel on a 16 core node with 'make -j
16 O=/mnt/0' where /mnt/0 is a ramdisk mounted via NFSRDMA.

This bug seems to only be tripped with devices having small fastreg page
list depths.  I didn't see it with mlx4, for instance.

Fixes: 0bf4828983df ('svcrdma: refactor marshalling logic')
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -146,7 +146,8 @@ int rdma_read_chunk_lcl(struct svcxprt_r
 	ctxt->read_hdr = head;
 	pages_needed =
 		min_t(int, pages_needed, rdma_read_max_sge(xprt, pages_needed));
-	read = min_t(int, pages_needed << PAGE_SHIFT, rs_length);
+	read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset,
+		     rs_length);
 
 	for (pno = 0; pno < pages_needed; pno++) {
 		int len = min_t(int, rs_length, PAGE_SIZE - pg_off);
@@ -245,7 +246,8 @@ int rdma_read_chunk_frmr(struct svcxprt_
 	ctxt->direction = DMA_FROM_DEVICE;
 	ctxt->frmr = frmr;
 	pages_needed = min_t(int, pages_needed, xprt->sc_frmr_pg_list_len);
-	read = min_t(int, pages_needed << PAGE_SHIFT, rs_length);
+	read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset,
+		     rs_length);
 
 	frmr->kva = page_address(rqstp->rq_arg.pages[pg_no]);
 	frmr->direction = DMA_FROM_DEVICE;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.2 00/54] 4.2.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200
  [PATCH 4.2 54/54] svcrdma: handle rdma read with a non-zero initial page offset Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200
  [PATCH 4.2 29/54] ARM: ux500: simplify secondary CPU boot Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200
  [PATCH 4.2 25/54] memcg: convert threshold to bytes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200
    Re: [PATCH 4.2 25/54] memcg: convert threshold to bytes Ben Hutchings <ben@decadent.org.uk> - 2015-10-24 07:50 +0200
      Re: [PATCH 4.2 25/54] memcg: convert threshold to bytes Michal Hocko <mhocko@kernel.org> - 2015-10-25 17:40 +0100
        Re: [PATCH 4.2 25/54] memcg: convert threshold to bytes Michal Hocko <mhocko@kernel.org> - 2015-10-27 11:40 +0100
  [PATCH 4.2 50/54] rbd: fix double free on rbd_dev->header_name Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200
  [PATCH 4.2 28/54] arm64: errata: use KBUILD_CFLAGS_MODULE for erratum #843419 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200
  [PATCH 4.2 51/54] timekeeping: Increment clock_was_set_seq in timekeeping_init() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:40 +0200
  [PATCH 4.2 49/54] dm thin: fix missing pool reference count decrement in pool_ctr error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:40 +0200
  Re: [PATCH 4.2 00/54] 4.2.5-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2015-10-24 00:00 +0200
    Re: [PATCH 4.2 00/54] 4.2.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-24 01:30 +0200
  Re: [PATCH 4.2 00/54] 4.2.5-stable review Guenter Roeck <linux@roeck-us.net> - 2015-10-24 04:10 +0200
    Re: [PATCH 4.2 00/54] 4.2.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-24 15:30 +0200

csiph-web