block: Reduce sysfs_lock locking inside blk_cleanup_queue()
authorBart Van Assche <bvanassche@acm.org>
Mon, 30 Sep 2019 23:00:44 +0000 (16:00 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 7 Oct 2019 14:31:59 +0000 (08:31 -0600)
Since blk_cleanup_queue() is called after blk_unregister_queue() and
since that last function removes all sysfs attributes, serializing
any code in blk_cleanup_queue() against sysfs callback methods nor against
I/O scheduler changes is necessary. Hence remove the syfs_lock locking
calls from the start of blk_cleanup_queue().

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c

index 8b51d9ec8ae3e0731559786d76648272ebebabe0..ae506ac2dd489a51053174a16682bc49355ad80c 100644 (file)
@@ -339,13 +339,11 @@ void blk_cleanup_queue(struct request_queue *q)
        WARN_ON_ONCE(blk_queue_registered(q));
 
        /* mark @q DYING, no new request or merges will be allowed afterwards */
-       mutex_lock(&q->sysfs_lock);
        blk_set_queue_dying(q);
 
        blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q);
        blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q);
        blk_queue_flag_set(QUEUE_FLAG_DYING, q);
-       mutex_unlock(&q->sysfs_lock);
 
        /*
         * Drain all requests queued before DYING marking. Set DEAD flag to