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@xxxxxxxxxx> --- Grow.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Grow.c b/Grow.c index 2a7587315817..aaf349e9722f 100644 --- a/Grow.c +++ b/Grow.c @@ -3028,6 +3028,12 @@ 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. + */ + sleep_for(5, 0, true); } c = map_num(pers, level); if (c) { -- 2.32.0 (Apple Git-132)