Skip to contentSkip to conversation

xprtrdma: Allocate missing pagelist

PATCH New Shirley Ma 1 participant 1 message May 21, 2014

Subsystems (3)
lore
Share & tools
lore

Shirley Ma

author
#0 lore raw

PATCH 1/1 xprtrdma: Allocate missing pagelist

This patch is for 3.15-rc5. Please review it.

GETACL relies on transport layer to alloc memory for reply buffer. However xprtrdma assumes that the reply buffer (pagelist) has been pre-allocated in upper layer. This problem was reported by IOL OFA lab test on PPC.

---

 net/sunrpc/xprtrdma/rpc_rdma.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/sunrpc/xprtrdma/rpc_rdma.c +6 -0
index 96ead52..748b771 100644
@@ -102,6 +102,12 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, unsigned int pos,
 	page_base = xdrbuf->page_base & ~PAGE_MASK;
 	p = 0;
 	while (len && n < nsegs) {
+		if (!ppages[p]) {
+			/* alloc the pagelist for receiving buffer */
+			ppages[p] = alloc_page(GFP_ATOMIC);
+			if (!ppages[p])
+				return 0;
+		}
 		seg[n].mr_page = ppages[p];
 		seg[n].mr_offset = (void *)(unsigned long) page_base;
 		seg[n].mr_len = min_t(u32, PAGE_SIZE - page_base, len);