]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - managemon.c
Correct readlink usage in sysfs.c
[thirdparty/mdadm.git] / managemon.c
index 94fbcb2ce67c519b212de1685a286c943cfff691..c947552eb7161d69a7aa7f358962ed46d3c84097 100644 (file)
@@ -379,7 +379,7 @@ static void manage_new(struct mdstat_ent *mdstat,
        new->action_fd = sysfs_open(new->devnum, NULL, "sync_action");
        new->info.state_fd = sysfs_open(new->devnum, NULL, "array_state");
        new->resync_start_fd = sysfs_open(new->devnum, NULL, "resync_start");
-       new->resync_start = 0;
+       get_resync_start(new);
        dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst),
                new->action_fd, new->info.state_fd);
 
@@ -436,7 +436,15 @@ static void handle_message(struct supertype *container, struct metadata_update *
        struct metadata_update *mu;
 
        if (msg->len == 0) {
+               int cnt = monitor_loop_cnt;
+               if (cnt & 1)
+                       cnt += 2; /* wait until next pselect */
+               else
+                       cnt += 3; /* wait for 2 pselects */
+               wakeup_monitor();
                wait_update_handled();
+               while (monitor_loop_cnt - cnt < 0)
+                       usleep(10 * 1000);
        } else {
                mu = malloc(sizeof(*mu));
                mu->len = msg->len;