linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mdadm/Incremental: wait a while before removing a member
@ 2025-10-17  8:30 Xiao Ni
  0 siblings, 0 replies; only message in thread
From: Xiao Ni @ 2025-10-17  8:30 UTC (permalink / raw)
  To: linux-raid; +Cc: mtkaczyk, ncroxon

We encountered a regression that member disk can't be removed in
incremental remove mode:
mdadm -If /dev/loop0
mdadm: Cannot remove member device loop0 from md127

It doesn't allow to remove a member if sync thread is running. mdadm -If
sets member disk faulty first, then it removes the disk. If sync thread
is running, it will be interrupted by setting a member faulty. But the sync
thread hasn't been reapped. So it needs to wait a while to let kernel to
reap sync thread.

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 Incremental.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Incremental.c b/Incremental.c
index ba3810e6157f..d04168121199 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1793,6 +1793,12 @@ int Incremental_remove(char *devname, char *id_path, int verbose)
 	if (rv && verbose >= 0)
 		pr_err("Cannot fail member device %s in array %s.\n", devnm, ent->devnm);
 
+	/*
+	 * If resync/recovery is running, sync thread is interrupted by setting member faulty.
+	 * And it needs to wait sometime to let kernel to reap sync thread. If not, it will
+	 * fail to remove it.
+	 */
+	sleep_for(5, 0, true);
 	if (rv == MDADM_STATUS_SUCCESS)
 		rv = sysfs_set_memb_state(ent->devnm, devnm, MEMB_STATE_REMOVE);
 
-- 
2.32.0 (Apple Git-132)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-17  8:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17  8:30 [PATCH 1/1] mdadm/Incremental: wait a while before removing a member Xiao Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).