提交 9ac07501 编写于 作者: S Steve Wise 提交者: Doug Ledford

svcrdma: limit FRMR page list lengths to device max

Svcrdma was incorrectly allocating fastreg MRs and page lists using
RPCSVC_MAXPAGES, which can exceed the device capabilities.  So limit
the depth to the minimum of RPCSVC_MAXPAGES and xprt->sc_frmr_pg_list_len.
Signed-off-by: NSteve Wise <swise@opengridcomputing.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 0410e38e
...@@ -733,17 +733,19 @@ static struct svc_rdma_fastreg_mr *rdma_alloc_frmr(struct svcxprt_rdma *xprt) ...@@ -733,17 +733,19 @@ static struct svc_rdma_fastreg_mr *rdma_alloc_frmr(struct svcxprt_rdma *xprt)
struct ib_mr *mr; struct ib_mr *mr;
struct ib_fast_reg_page_list *pl; struct ib_fast_reg_page_list *pl;
struct svc_rdma_fastreg_mr *frmr; struct svc_rdma_fastreg_mr *frmr;
u32 num_sg;
frmr = kmalloc(sizeof(*frmr), GFP_KERNEL); frmr = kmalloc(sizeof(*frmr), GFP_KERNEL);
if (!frmr) if (!frmr)
goto err; goto err;
mr = ib_alloc_mr(xprt->sc_pd, IB_MR_TYPE_MEM_REG, RPCSVC_MAXPAGES); num_sg = min_t(u32, RPCSVC_MAXPAGES, xprt->sc_frmr_pg_list_len);
mr = ib_alloc_mr(xprt->sc_pd, IB_MR_TYPE_MEM_REG, num_sg);
if (IS_ERR(mr)) if (IS_ERR(mr))
goto err_free_frmr; goto err_free_frmr;
pl = ib_alloc_fast_reg_page_list(xprt->sc_cm_id->device, pl = ib_alloc_fast_reg_page_list(xprt->sc_cm_id->device,
RPCSVC_MAXPAGES); num_sg);
if (IS_ERR(pl)) if (IS_ERR(pl))
goto err_free_mr; goto err_free_mr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册