Since elevator_init_rq() is called before the device queue is registered in sysfs, there is no possible conflict with elevator_switch(). Remove the unnecessary locking of q->sysfs_lock mutex. Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx> --- block/elevator.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index 7fff06751633..6208ddc334ef 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -617,17 +617,12 @@ void elevator_init_mq(struct request_queue *q) if (q->nr_hw_queues != 1) return; - /* - * q->sysfs_lock must be held to provide mutual exclusion between - * elevator_switch() and here. - */ - mutex_lock(&q->sysfs_lock); if (unlikely(q->elevator)) - goto out_unlock; + return; e = elevator_get(q, "mq-deadline", false); if (!e) - goto out_unlock; + return; err = blk_mq_init_sched(q, e); if (err) { @@ -635,9 +630,6 @@ void elevator_init_mq(struct request_queue *q) "falling back to \"none\"\n", e->elevator_name); elevator_put(e); } - -out_unlock: - mutex_unlock(&q->sysfs_lock); } -- 2.21.0