md: Explicitly create command-line configured devices
authorChris Webb <chris@arachsys.com>
Wed, 1 Jun 2022 11:03:07 +0000 (12:03 +0100)
committerSong Liu <song@kernel.org>
Sun, 3 Jul 2022 14:55:39 +0000 (07:55 -0700)
commit467f738d0e821f36bf6316aaab4ef5bdef9b003e
tree12afa8c6dd1294e52186467b50cdc62ad36aeb34
parent92a2748dc3c52a5484cede626fe152a48d81782d
md: Explicitly create command-line configured devices

Boot-time assembly of arrays with md= command-line arguments breaks when
CONFIG_BLOCK_LEGACY_AUTOLOAD is unset. md_setup_drive() in md-autodetect.c
calls blkdev_get_by_dev(), assuming this implicitly creates the block
device.

Fix this by attempting to md_alloc() the array first. As in the probe path,
ignore any error as failure is caught by blkdev_get_by_dev() anyway.

Signed-off-by: Chris Webb <chris@arachsys.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/md-autodetect.c
drivers/md/md.c
drivers/md/md.h