]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: Fix sbitmap depth in scsi_realloc_sdev_budget_map()
authorJohn Garry <john.garry@huawei.com>
Wed, 16 Mar 2022 09:44:30 +0000 (17:44 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 30 Mar 2022 03:45:01 +0000 (23:45 -0400)
commit592591abb1ed49e930434c698c10aa5aa74351d5
treee16294017a68809b5089ded73c1a5807cf262cf1
parent0dd13d080065dd1c5ea29efa3ab9052798a424e9
scsi: core: Fix sbitmap depth in scsi_realloc_sdev_budget_map()

In commit 039613207ebe ("scsi: core: Reallocate device's budget map on
queue depth change"), the sbitmap for the device budget map may be
reallocated after the slave device depth is configured.

When the sbitmap is reallocated we use the result from
scsi_device_max_queue_depth() for the sbitmap size, but don't resize to
match the actual device queue depth.

Fix by resizing the sbitmap after reallocating the budget sbitmap. We do
this instead of init'ing the sbitmap to the device queue depth as the user
may want to change the queue depth later via sysfs or other.

Link: https://lore.kernel.org/r/1647423870-143867-1-git-send-email-john.garry@huawei.com
Fixes: 039613207ebe ("scsi: core: Reallocate device's budget map on queue depth change")
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_scan.c