[PATCH v1] scsi: storvsc: Cap cmd_per_lun at can_queue

From: Melanie Plageman (Microsoft)
Date: Fri Mar 05 2021 - 18:23:32 EST


The scsi_device->queue_depth is set to Scsi_Host->cmd_per_lun during
allocation.

Cap cmd_per_lun at can_queue to avoid dispatch errors.

Signed-off-by: Melanie Plageman (Microsoft) <melanieplageman@xxxxxxxxx>
---
drivers/scsi/storvsc_drv.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 6bc5453cea8a..d7953a6e00e6 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1946,6 +1946,8 @@ static int storvsc_probe(struct hv_device *device,
(max_sub_channels + 1) *
(100 - ring_avail_percent_lowater) / 100;

+ scsi_driver.cmd_per_lun = min_t(u32, scsi_driver.cmd_per_lun, scsi_driver.can_queue);
+
host = scsi_host_alloc(&scsi_driver,
sizeof(struct hv_host_device));
if (!host)
--
2.20.1