]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: fix reshape from RAID5 to RAID6 with backup file
authorNigel Croxon <ncroxon@redhat.com>
Wed, 20 Jan 2021 20:05:42 +0000 (15:05 -0500)
committerJes Sorensen <jsorensen@fb.com>
Wed, 3 Mar 2021 14:29:17 +0000 (09:29 -0500)
Reshaping a 3-disk RAID5 to 4-disk RAID6 will cause a hang of
the resync after the grow.

Adding a spare disk to avoid degrading the array when growing
is successful, but not successful when supplying a backup file
on the command line. If the reshape job is not already running,
set the sync_max value to max.

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index 6b8321c5172f11e352013f55825f5de2de620dc7..5c2512f6318026bcfae2975fd07758f889172f29 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -931,12 +931,15 @@ int start_reshape(struct mdinfo *sra, int already_running,
        err = err ?: sysfs_set_num(sra, NULL, "sync_max", sync_max_to_set);
        if (!already_running && err == 0) {
                int cnt = 5;
+               int err2;
                do {
                        err = sysfs_set_str(sra, NULL, "sync_action",
                                            "reshape");
-                       if (err)
+                       err2 = sysfs_set_str(sra, NULL, "sync_max",
+                                           "max");
+                       if (err || err2)
                                sleep(1);
-               } while (err && errno == EBUSY && cnt-- > 0);
+               } while (err && err2 && errno == EBUSY && cnt-- > 0);
        }
        return err;
 }