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)
committerSong Liu <song@kernel.org>
Wed, 20 Jul 2022 06:03:26 +0000 (23:03 -0700)
commitd9406f31a96407754a05e1b6510b02684f622922
tree2f18672d9c2f5c2e0dc8f8e0aa71c5d34f7f48d2
parent45e0d274008202cc336ba2fdf1f2129b4d888ea3
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>
drivers/md/md.c
drivers/md/md.h