aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/srp
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2016-04-22 14:14:15 -0700
committerDoug Ledford <dledford@redhat.com>2016-05-12 14:18:56 -0400
commitffc548bb3601f0250474afcfa10ceb0b8b8b9764 (patch)
tree5aa96222de3017d7d3cea3182b678aaa2b7223a4 /drivers/infiniband/ulp/srp
parentIB/srp: Introduce target->mr_pool_size (diff)
downloadlinux-dev-ffc548bb3601f0250474afcfa10ceb0b8b8b9764.tar.xz
linux-dev-ffc548bb3601f0250474afcfa10ceb0b8b8b9764.zip
IB/srp: Avoid that mapping failure triggers an infinite loop
The srp_queuecommand() function translates ENOMEM into QUEUE_FULL which causes the SCSI mid-layer to retry the command. All other error codes are translated into DID_ERROR which causes the SCSI command to fail. Return E2BIG if mapping will always fail to prevent that the SCSI mid-layer keeps resubmitting a command forever. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Sagi Grimberg <sagi@grimberg.me> Cc: Laurence Oberman <loberman@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp/srp')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 92d2d98c9831..fbd2edbedf05 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1681,6 +1681,8 @@ map_complete:
unmap:
srp_unmap_data(scmnd, ch, req);
+ if (ret == -ENOMEM && req->nmdesc >= target->mr_pool_size)
+ ret = -E2BIG;
return ret;
}