]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdopen: always try create_named_array()
authorNeilBrown <neilb@suse.de>
Tue, 14 Mar 2023 00:06:25 +0000 (11:06 +1100)
committerJes Sorensen <jes@trained-monkey.org>
Sun, 19 Mar 2023 16:35:40 +0000 (12:35 -0400)
mdopen() will use create_named_array() to ask the kernel to create the
given md array, but only if it is given a number or name.
If it is NOT given a name and is required to choose one itself using
find_free_devnm() it does NOT use create_named_array().

On kernels with CONFIG_BLOCK_LEGACY_AUTOLOAD not set, this can result in
failure to assemble an array.  This can particularly seen when the
"name" of the array begins with a host name different to the name of the
host running the command.

So add the missing call to create_named_array().

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217074
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
mdopen.c

index d18c931996d28f52948e7a3871f86daa2cd13d39..810f79a3d19adc2d72b2a47c64819e02399885cd 100644 (file)
--- a/mdopen.c
+++ b/mdopen.c
@@ -370,6 +370,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
                }
                if (block_udev)
                        udev_block(devnm);
+               create_named_array(devnm);
        }
 
        sprintf(devname, "/dev/%s", devnm);