md: only delete entries from all_mddevs when the disk is freed
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Jul 2022 09:18:23 +0000 (11:18 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Aug 2022 23:22:44 +0000 (17:22 -0600)
commit12a6caf273240ae42842de8cc05feaa86e582d61
tree46a857e07a65f026f4f30d4d69475891349a0e5c
parent16648bac862fd9c6490a465533345fbeaa6466e0
md: only delete entries from all_mddevs when the disk is freed

This ensures device names don't get prematurely reused.  Instead add a
deleted flag to skip already deleted devices in mddev_get and other
places that only want to see live mddevs.

Reported-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/md.c
drivers/md/md.h