diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2018-02-06 16:06:27 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2018-02-06 16:06:27 -0500 |
commit | 0c8cbcd337aeae013bb6230f13b77dde0735758f (patch) | |
tree | 35bdcc8075be21a0926d50015d26ac3c7412792d | |
parent | 9b30889c548a4d45bfe6226e58de32504c1d682f (diff) | |
parent | e89e8d8fcdc6751e86ccad794b052fe67e6ad619 (diff) |
Merge tag 'nfs-rdma-for-4.16-2' of git://git.linux-nfs.org/projects/anna/linux-nfs
NFS-over-RDMA client fixes for Linux 4.16 #2
Stable fixes:
- Fix calculating ri_max_send_sges, which can oops if max_sge is too small
- Fix a BUG after device removal if freed resources haven't been allocated yet
-rw-r--r-- | net/sunrpc/xprtrdma/rpc_rdma.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/verbs.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 162e5dd82466..f0855a959a27 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c | |||
@@ -143,7 +143,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt, | |||
143 | if (xdr->page_len) { | 143 | if (xdr->page_len) { |
144 | remaining = xdr->page_len; | 144 | remaining = xdr->page_len; |
145 | offset = offset_in_page(xdr->page_base); | 145 | offset = offset_in_page(xdr->page_base); |
146 | count = 0; | 146 | count = RPCRDMA_MIN_SEND_SGES; |
147 | while (remaining) { | 147 | while (remaining) { |
148 | remaining -= min_t(unsigned int, | 148 | remaining -= min_t(unsigned int, |
149 | PAGE_SIZE - offset, remaining); | 149 | PAGE_SIZE - offset, remaining); |
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index f4eb63e8e689..e6f84a6434a0 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -505,7 +505,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, | |||
505 | pr_warn("rpcrdma: HCA provides only %d send SGEs\n", max_sge); | 505 | pr_warn("rpcrdma: HCA provides only %d send SGEs\n", max_sge); |
506 | return -ENOMEM; | 506 | return -ENOMEM; |
507 | } | 507 | } |
508 | ia->ri_max_send_sges = max_sge - RPCRDMA_MIN_SEND_SGES; | 508 | ia->ri_max_send_sges = max_sge; |
509 | 509 | ||
510 | if (ia->ri_device->attrs.max_qp_wr <= RPCRDMA_BACKWARD_WRS) { | 510 | if (ia->ri_device->attrs.max_qp_wr <= RPCRDMA_BACKWARD_WRS) { |
511 | dprintk("RPC: %s: insufficient wqe's available\n", | 511 | dprintk("RPC: %s: insufficient wqe's available\n", |
@@ -1502,6 +1502,9 @@ __rpcrdma_dma_map_regbuf(struct rpcrdma_ia *ia, struct rpcrdma_regbuf *rb) | |||
1502 | static void | 1502 | static void |
1503 | rpcrdma_dma_unmap_regbuf(struct rpcrdma_regbuf *rb) | 1503 | rpcrdma_dma_unmap_regbuf(struct rpcrdma_regbuf *rb) |
1504 | { | 1504 | { |
1505 | if (!rb) | ||
1506 | return; | ||
1507 | |||
1505 | if (!rpcrdma_regbuf_is_mapped(rb)) | 1508 | if (!rpcrdma_regbuf_is_mapped(rb)) |
1506 | return; | 1509 | return; |
1507 | 1510 | ||
@@ -1517,9 +1520,6 @@ rpcrdma_dma_unmap_regbuf(struct rpcrdma_regbuf *rb) | |||
1517 | void | 1520 | void |
1518 | rpcrdma_free_regbuf(struct rpcrdma_regbuf *rb) | 1521 | rpcrdma_free_regbuf(struct rpcrdma_regbuf *rb) |
1519 | { | 1522 | { |
1520 | if (!rb) | ||
1521 | return; | ||
1522 | |||
1523 | rpcrdma_dma_unmap_regbuf(rb); | 1523 | rpcrdma_dma_unmap_regbuf(rb); |
1524 | kfree(rb); | 1524 | kfree(rb); |
1525 | } | 1525 | } |