]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - managemon.c
mdmon: manage_member: fix race condition during slow meta data writes
[thirdparty/mdadm.git] / managemon.c
index a6551081424b094a7d16f0207016248d0746f251..40c863f1edd57d0622d0c0eb195be4930e344767 100644 (file)
@@ -535,8 +535,14 @@ static void manage_member(struct mdstat_ent *mdstat,
                }
                queue_metadata_update(updates);
                updates = NULL;
+               while (update_queue_pending || update_queue) {
+                       check_update_queue(container);
+                       usleep(15*1000);
+               }
                replace_array(container, a, newa);
-               sysfs_set_str(&a->info, NULL, "sync_action", "recover");
+               if (sysfs_set_str(&a->info, NULL, "sync_action", "recover")
+                   == 0)
+                       newa->prev_action = recover;
                dprintf("%s: recovery started on %s\n", __func__,
                        a->info.sys_name);
  out: