summaryrefslogtreecommitdiffstats
path: root/drivers/md/md-autodetect.c
diff options
context:
space:
mode:
authorChris Webb <chris@arachsys.com>2022-06-01 13:03:07 +0200
committerJens Axboe <axboe@kernel.dk>2022-08-03 01:14:40 +0200
commit05ce7fb946c37fc6fc8bf14073279e570f78f69e (patch)
tree268dc1f9fedfc1cfdf5d5d6239795bff20b2812d /drivers/md/md-autodetect.c
parentmd: Notify sysfs sync_completed in md_reap_sync_thread() (diff)
downloadlinux-05ce7fb946c37fc6fc8bf14073279e570f78f69e.tar.xz
linux-05ce7fb946c37fc6fc8bf14073279e570f78f69e.zip
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> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/md-autodetect.c')
-rw-r--r--drivers/md/md-autodetect.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/md-autodetect.c b/drivers/md/md-autodetect.c
index 2cf973722f59..344910ba435c 100644
--- a/drivers/md/md-autodetect.c
+++ b/drivers/md/md-autodetect.c
@@ -169,6 +169,7 @@ static void __init md_setup_drive(struct md_setup_args *args)
pr_info("md: Loading %s: %s\n", name, args->device_names);
+ md_alloc(mdev, name);
bdev = blkdev_get_by_dev(mdev, FMODE_READ, NULL);
if (IS_ERR(bdev)) {
pr_err("md: open failed - cannot start array %s\n", name);