Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

svcrdma: Adjust the number of entries in svc_rdma_recv_ctxt::rc_pages

Allow allocation of more entries in the rc_pages[] array when the
maximum size of an RPC message is increased.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

Chuck Lever 81381d1a f4126823

+8 -3
+2 -1
include/linux/sunrpc/svc_rdma.h
··· 202 202 struct svc_rdma_pcl rc_reply_pcl; 203 203 204 204 unsigned int rc_page_count; 205 - struct page *rc_pages[RPCSVC_MAXPAGES]; 205 + unsigned long rc_maxpages; 206 + struct page *rc_pages[] __counted_by(rc_maxpages); 206 207 }; 207 208 208 209 /*
+6 -2
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
··· 120 120 { 121 121 int node = ibdev_to_node(rdma->sc_cm_id->device); 122 122 struct svc_rdma_recv_ctxt *ctxt; 123 + unsigned long pages; 123 124 dma_addr_t addr; 124 125 void *buffer; 125 126 126 - ctxt = kzalloc_node(sizeof(*ctxt), GFP_KERNEL, node); 127 + pages = svc_serv_maxpages(rdma->sc_xprt.xpt_server); 128 + ctxt = kzalloc_node(struct_size(ctxt, rc_pages, pages), 129 + GFP_KERNEL, node); 127 130 if (!ctxt) 128 131 goto fail0; 132 + ctxt->rc_maxpages = pages; 129 133 buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node); 130 134 if (!buffer) 131 135 goto fail1; ··· 501 497 * a computation, perform a simple range check. This is an 502 498 * arbitrary but sensible limit (ie, not architectural). 503 499 */ 504 - if (unlikely(segcount > RPCSVC_MAXPAGES)) 500 + if (unlikely(segcount > rctxt->rc_maxpages)) 505 501 return false; 506 502 507 503 p = xdr_inline_decode(&rctxt->rc_stream,