[v3,5/7] block: save previous hardware queue count before udpate
diff mbox series

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

Commit Message

Weiping Zhang April 6, 2020, 7:37 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.

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

Comments

Bart Van Assche April 20, 2020, 9 p.m. UTC | #1
On 4/6/20 12:37 PM, 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.
> 
> Signed-off-by: Weiping Zhang <zhangweiping@didiglobal.com>
> ---
>   block/blk-mq.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 406df9ce9b55..df243c19a158 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -3342,11 +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:

How about adding Fixes: and Cc: stable tags? Anyway:

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 406df9ce9b55..df243c19a158 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3342,11 +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: