]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/Grow: Can't open raid when running --grow --continue
authorXiao Ni <xni@redhat.com>
Wed, 11 Sep 2024 08:54:25 +0000 (16:54 +0800)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Mon, 23 Sep 2024 08:48:32 +0000 (10:48 +0200)
It passes 'array' as devname in Grow_continue. So it fails to
open raid device. Use mdinfo to open raid device.

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index 3b9f994200aaffdc5eb402d9bcea008f2ff5c4d4..ebb53a0dfe9c693330a77e201c86c435192d1727 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -3694,9 +3694,12 @@ started:
                set_array_size(st, info, info->text_version);
 
        if (info->new_level != reshape.level) {
-               if (fd < 0)
-                       fd = open(devname, O_RDONLY);
-               impose_level(fd, info->new_level, devname, verbose);
+               fd = open_dev(sra->sys_name);
+               if (fd < 0) {
+                       pr_err("Can't open %s\n", sra->sys_name);
+                       goto out;
+               }
+               impose_level(fd, info->new_level, sra->sys_name, verbose);
                close(fd);
                if (info->new_level == 0)
                        st->update_tail = NULL;