diff mbox series

[v2,4/4] mdadm/Grow: sleep a while after removing disk in impose_level

Message ID 20240911085432.37828-5-xni@redhat.com (mailing list archive)
State Accepted
Headers show
Series mdadm tests fix | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_12-PR success PR summary
mdraidci/vmtest-md-6_12-VM_Test-0 success Logs for build-kernel

Commit Message

Xiao Ni Sept. 11, 2024, 8:54 a.m. UTC
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>
---
v2: add log to give friendly message
 Grow.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/Grow.c b/Grow.c
index ebb53a0dfe9c..60076f56054c 100644
--- 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) {