diff mbox

[11/11] IB/srp: Prevent mapping failures

Message ID 571FF562.3040902@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche April 26, 2016, 11:10 p.m. UTC
On 04/26/2016 02:08 PM, Sagi Grimberg wrote:
>>> I can add a WARN_ON_ONCE() statement for max_pages_per_mr == 1. That 
>>> will
>>> make it easy to figure out where to start looking if in the future a HCA
>>> driver would be added that causes max_pages_per_mr == 1.
> 
> If we're on the imaginary path, you can flat out fail the host creation.

How about folding the following change into this patch - this change
disables memory registration if max_mr_size <= 1:


Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 8ae1543..9072f7f 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3586,7 +3586,7 @@  static void srp_add_one(struct ib_device *device)
 			   IB_DEVICE_MEM_MGT_EXTENSIONS);
 	if (!srp_dev->has_fmr && !srp_dev->has_fr) {
 		dev_warn(&device->dev, "neither FMR nor FR is supported\n");
-	} else if (register_always >= 0) {
+	} else if (register_always >= 0 && device->attrs.max_mr_size > 1) {
 		srp_dev->use_fast_reg = (srp_dev->has_fr &&
 					 (!srp_dev->has_fmr || prefer_fr));
 		srp_dev->use_fmr = !srp_dev->use_fast_reg && srp_dev->has_fmr;