Skip to content

Commit c6ba933

Browse files
Ming Leiaxboe
authored andcommitted
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 2f8f133 ("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 <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Greg KH <[email protected]> Cc: Mike Snitzer <[email protected]> Cc: Bart Van Assche <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent c48dac1 commit c6ba933

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

block/blk-mq.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,11 +2456,6 @@ static void blk_mq_map_swqueue(struct request_queue *q)
24562456
struct blk_mq_ctx *ctx;
24572457
struct blk_mq_tag_set *set = q->tag_set;
24582458

2459-
/*
2460-
* Avoid others reading imcomplete hctx->cpumask through sysfs
2461-
*/
2462-
mutex_lock(&q->sysfs_lock);
2463-
24642459
queue_for_each_hw_ctx(q, hctx, i) {
24652460
cpumask_clear(hctx->cpumask);
24662461
hctx->nr_ctx = 0;
@@ -2521,8 +2516,6 @@ static void blk_mq_map_swqueue(struct request_queue *q)
25212516
HCTX_TYPE_DEFAULT, i);
25222517
}
25232518

2524-
mutex_unlock(&q->sysfs_lock);
2525-
25262519
queue_for_each_hw_ctx(q, hctx, i) {
25272520
/*
25282521
* If no software queues are mapped to this hardware queue,

0 commit comments

Comments
 (0)