]> git.itanic.dy.fi Git - linux-stable/commit
block: call blk_mq_exit_queue from disk_release for never added disks
authorChristoph Hellwig <hch@lst.de>
Wed, 20 Jul 2022 13:05:41 +0000 (15:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:32:23 +0000 (11:32 +0200)
commit2f092fd2ce24eebb6f56f4b558654ba2fb4e5fe8
tree14585b26feb683185859f58fc641f39fabb7bb98
parent47f57236ba4027840eb146117b5080fece4ec358
block: call blk_mq_exit_queue from disk_release for never added disks

commit c5db2cfc6274692d821d33b59acb6ff615e350c1 upstream.

To undo the all initialization from blk_mq_init_allocated_queue in case
of a probe failure where add_disk is never called we have to call
blk_mq_exit_queue from put_disk.

This relies on the fact that drivers always call blk_mq_free_tag_set
after calling put_disk in the probe error path if they have a gendisk
at all.

We should be doing this in general, but can't do it for the normal
teardown case (yet) as the tagset can be gone by the time the disk is
released once it was added.  I hope to sort this out properly eventually
but for now this isolated hack will do it.

Fixes: 6f8191fdf41d ("block: simplify disk shutdown")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220720130541.1323531-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/genhd.c