aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2017-05-30 14:39:11 -0400
committerJens Axboe <axboe@fb.com>2017-05-30 14:32:37 -0400
commite4dc2b32df5573b077f6723e01cf761d236d5113 (patch)
tree33a61d78cffb1db47474a60157d550c55e0ce6a8
parentfa9765323a93473d3853d04c9903958453c92ad4 (diff)
blk-mq: Take tagset lock when updating hw queues
The tagset lock needs to be held when iterating the tag_list, so a lockdep assert was added when updating number of hardware queues. The drivers calling this API, however, were unaware of the new requirement, so are failing the assertion. This patch takes the lock within the blk-mq function so the drivers do not have to be modified in order to be safe. Fixes: 705cda97e ("blk-mq: Make it safe to use RCU to iterate over blk_mq_tag_set.tag_list") Reported-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk> Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/blk-mq.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f2224ffd225d..1bcccedcc74f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2641,7 +2641,8 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
2641 return ret; 2641 return ret;
2642} 2642}
2643 2643
2644void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues) 2644static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set,
2645 int nr_hw_queues)
2645{ 2646{
2646 struct request_queue *q; 2647 struct request_queue *q;
2647 2648
@@ -2665,6 +2666,13 @@ void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues)
2665 list_for_each_entry(q, &set->tag_list, tag_set_list) 2666 list_for_each_entry(q, &set->tag_list, tag_set_list)
2666 blk_mq_unfreeze_queue(q); 2667 blk_mq_unfreeze_queue(q);
2667} 2668}
2669
2670void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues)
2671{
2672 mutex_lock(&set->tag_list_lock);
2673 __blk_mq_update_nr_hw_queues(set, nr_hw_queues);
2674 mutex_unlock(&set->tag_list_lock);
2675}
2668EXPORT_SYMBOL_GPL(blk_mq_update_nr_hw_queues); 2676EXPORT_SYMBOL_GPL(blk_mq_update_nr_hw_queues);
2669 2677
2670/* Enable polling stats and return whether they were already enabled. */ 2678/* Enable polling stats and return whether they were already enabled. */