When allocating a multiqueue structure the number of tags might
have been reduced due to memory pressure.
So update can_queue with the new value.

Signed-off-by: Hannes Reinecke <[email protected]>
---
 drivers/scsi/scsi_lib.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c71344a..e8fea8e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2099,6 +2099,7 @@ struct request_queue *scsi_mq_alloc_queue(struct 
scsi_device *sdev)
 int scsi_mq_setup_tags(struct Scsi_Host *shost)
 {
        unsigned int cmd_size, sgl_size, tbl_size;
+       int ret;
 
        tbl_size = shost->sg_tablesize;
        if (tbl_size > SG_CHUNK_SIZE)
@@ -2119,7 +2120,12 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
                BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy);
        shost->tag_set.driver_data = shost;
 
-       return blk_mq_alloc_tag_set(&shost->tag_set);
+       ret = blk_mq_alloc_tag_set(&shost->tag_set);
+       if (!ret) {
+               /* queue depth might have been adjusted */
+               shost->can_queue = shost->tag_set.queue_depth;
+       }
+       return ret;
 }
 
 void scsi_mq_destroy_tags(struct Scsi_Host *shost)
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to