[v2,1/2] block: save previous hardware queue count before udpate
diff mbox series

Message ID a0230ed5731a2c9183e1929611755579f20616ff.1586006904.git.zhangweiping@didiglobal.com
State New
Headers show
Series
  • Fix potential kernel panic when increase hardware queue
Related show

Commit Message

Weiping Zhang April 4, 2020, 1:35 p.m. UTC
blk_mq_realloc_tag_set_tags will update set->nr_hw_queues, so
save old set->nr_hw_queues before call this function.

Since set->nr_hw_queues has been updated in blk_mq_realloc_tag_set_tags,
no need set it again.

Signed-off-by: Weiping Zhang <zhangweiping@didiglobal.com>
---
 block/blk-mq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Bart Van Assche April 5, 2020, 2:20 a.m. UTC | #1
On 2020-04-04 06:35, Weiping Zhang wrote:
> blk_mq_realloc_tag_set_tags will update set->nr_hw_queues, so
> save old set->nr_hw_queues before call this function.
> 
> Since set->nr_hw_queues has been updated in blk_mq_realloc_tag_set_tags,
> no need set it again.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

Patch
diff mbox series

diff --git a/block/blk-mq.c b/block/blk-mq.c
index f6291ceedee4..c86d1c81d3d6 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3342,12 +3342,11 @@  static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set,
 		blk_mq_sysfs_unregister(q);
 	}
 
+	prev_nr_hw_queues = set->nr_hw_queues;
 	if (blk_mq_realloc_tag_set_tags(set, set->nr_hw_queues, nr_hw_queues) <
 	    0)
 		goto reregister;
 
-	prev_nr_hw_queues = set->nr_hw_queues;
-	set->nr_hw_queues = nr_hw_queues;
 	blk_mq_update_queue_map(set);
 fallback:
 	list_for_each_entry(q, &set->tag_list, tag_set_list) {