]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/Grow: sleep a while after removing disk in impose_level
authorXiao Ni <xni@redhat.com>
Wed, 11 Sep 2024 08:54:26 +0000 (16:54 +0800)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Mon, 23 Sep 2024 08:48:42 +0000 (10:48 +0200)
It needs to remove disks when reshaping from raid456 to raid0. In
kernel space it sets MD_RECOVERY_RUNNING. And it will fail to change
level. So wait sometime to let md thread to clear this flag.

This is found by test case 05r6tor0.

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 ebb53a0dfe9c693330a77e201c86c435192d1727..60076f56054ca2c5c38a1fd90aed48a732f0194c 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -3034,6 +3034,13 @@ static int impose_level(int fd, int level, char *devname, int verbose)
                              makedev(disk.major, disk.minor));
                        hot_remove_disk(fd, makedev(disk.major, disk.minor), 1);
                }
+               /*
+                * hot_remove_disk lets kernel set MD_RECOVERY_RUNNING
+                * and it can't set level. It needs to wait sometime
+                * to let md thread to clear the flag.
+                */
+               pr_info("wait 5 seconds to give kernel space to finish job\n");
+               sleep_for(5, 0, true);
        }
        c = map_num(pers, level);
        if (c) {