mdadm/Incremental: wait a while before removing a member
PATCH 1/1 mdadm/Incremental: wait a while before removing a member
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 <[email protected]>
--- Incremental.c | 6 ++++++ 1 file changed, 6 insertions(+)
Incremental.c +6 -0
@@ -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 );
Signature · 1 line
2.32.0 (Apple Git-132)