Commit c6ba9333 authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

blk-mq: don't hold q->sysfs_lock in blk_mq_map_swqueue

blk_mq_map_swqueue() is called from blk_mq_init_allocated_queue()
and blk_mq_update_nr_hw_queues(). For the former caller, the kobject
isn't exposed to userspace yet. For the latter caller, hctx sysfs entries
and debugfs are un-registered before updating nr_hw_queues.

On the other hand, commit 2f8f1336

 ("blk-mq: always free hctx after
request queue is freed") moves freeing hctx into queue's release
handler, so there won't be race with queue release path too.

So don't hold q->sysfs_lock in blk_mq_map_swqueue().

Cc: Christoph Hellwig <>
Cc: Hannes Reinecke <>
Cc: Greg KH <>
Cc: Mike Snitzer <>
Cc: Bart Van Assche <>
Reviewed-by: default avatarBart Van Assche <>
Signed-off-by: default avatarMing Lei <>
Signed-off-by: default avatarJens Axboe <>
parent c48dac13
......@@ -2456,11 +2456,6 @@ static void blk_mq_map_swqueue(struct request_queue *q)
struct blk_mq_ctx *ctx;
struct blk_mq_tag_set *set = q->tag_set;
* Avoid others reading imcomplete hctx->cpumask through sysfs
queue_for_each_hw_ctx(q, hctx, i) {
hctx->nr_ctx = 0;
......@@ -2521,8 +2516,6 @@ static void blk_mq_map_swqueue(struct request_queue *q)
queue_for_each_hw_ctx(q, hctx, i) {
* If no software queues are mapped to this hardware queue,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment