]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - monitor.c
Detail: clean up handing of the 'info' we load from superblock.
[thirdparty/mdadm.git] / monitor.c
index 12f8d3e6237c8bef698b15dc7f884630f1dc110c..59b4181954c24c0dc209e93c17c6ba391e2a4eab 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -334,10 +334,14 @@ static int read_and_act(struct active_array *a)
         */
        if (sync_completed > a->last_checkpoint &&
            sync_completed - a->last_checkpoint > a->info.component_size >> 4 &&
-           a->curr_action > reshape && a->next_action == bad_action) {
+           a->curr_action > reshape) {
+               /* A (non-reshape) sync_action has reached a checkpoint.
+                * Record the updated position in the metadata
+                */
+               a->last_checkpoint = sync_completed;
+               a->container->ss->set_array_state(a, a->curr_state <= clean);
+       } else if (sync_completed > a->last_checkpoint)
                a->last_checkpoint = sync_completed;
-               a->next_action = idle;
-       }
 
        a->container->ss->sync_metadata(a->container);
        dprintf("%s(%d): state:%s action:%s next(", __func__, a->info.container_member,