UPSTREAM: usb-storage: fix queue freeze vs limits lock order

Match the locking order used by the core block code by only freezing
the queue after taking the limits lock using the
queue_limits_commit_update_frozen helper.

Change-Id: I8bd4b4978412ce1e7edb15980efd0bab7fd31946
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20250110054726.1499538-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 1233751f7df722435bb93e928d64334db260b90d)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Christoph Hellwig
2025-01-10 06:47:17 +01:00
committed by Bart Van Assche
parent 96dfef3be8
commit 02cf51391e

View File

@@ -592,12 +592,9 @@ static ssize_t max_sectors_store(struct device *dev, struct device_attribute *at
if (sscanf(buf, "%hu", &ms) <= 0)
return -EINVAL;
blk_mq_freeze_queue(sdev->request_queue);
lim = queue_limits_start_update(sdev->request_queue);
lim.max_hw_sectors = ms;
ret = queue_limits_commit_update(sdev->request_queue, &lim);
blk_mq_unfreeze_queue(sdev->request_queue);
ret = queue_limits_commit_update_frozen(sdev->request_queue, &lim);
if (ret)
return ret;
return count;