hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I959FN CVE: NA
--------------------------------
This reverts commit 961e2d0bd3b537aa39b58b074aec4a6c6a9fea47.
When blk_mq_init_allocated_queue() fail, blk_mq_init_queue() will catch the error code and call blk_cleanup_queue() to release resource. So it's not necessary to call blk_mq_del_queue_tag_set() in blk_mq_init_allocated_queue(). What's more, hctx can't be released since commit 73d9c8d4c001 ("blk-mq: Fix memory leak in blk_mq_init_allocated_queue error handling") set q->nr_hw_queues as zero.
Signed-off-by: Li Lingfeng lilingfeng3@huawei.com --- block/blk-mq.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c index 96debbe63ad2..41a3f6b89319 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2874,8 +2874,6 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set, struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, struct request_queue *q) { - int ret = -ENOMEM; - /* mark the queue as mq asap */ q->mq_ops = set->ops;
@@ -2942,18 +2940,17 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, blk_mq_map_swqueue(q);
if (!(set->flags & BLK_MQ_F_NO_SCHED)) { + int ret; + ret = elevator_init_mq(q); if (ret) - goto err_tag_set; + return ERR_PTR(ret); }
return q;
-err_tag_set: - blk_mq_del_queue_tag_set(q); err_hctxs: kfree(q->queue_hw_ctx); - q->nr_hw_queues = 0; err_sys_init: blk_mq_sysfs_deinit(q); err_exit: