Re: [PATCH v2] scsi: core: Fix sbitmap depth in scsi_realloc_sdev_budget_map()

From: Bart Van Assche
Date: Wed Mar 16 2022 - 10:29:31 EST


On 3/16/22 02:44, John Garry wrote:
In commit edb854a3680b ("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.

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>