]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: Last checkpoint is not set
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 3 Feb 2011 06:34:27 +0000 (17:34 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 3 Feb 2011 06:34:27 +0000 (17:34 +1100)
When reshape is finished monitor has to set last checkpoint
to the array end to allow metatdata for reshape finalization.
Metadata has to know if reshape is finished or it is broken
On reshape finish metadata finalization is required.
When reshape is broken, metadata must remain as is to allow
for reshape restart from checkpoint.

This can be resolved based on reshape_position sysfs entry.
When it is equal to 'none', it means that md finishes work.
In such situation move checkpoint to the end of array.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
monitor.c

index 8d33a5dd0b9dc0d7920c9a3781b21e50689c4c7e..fb2288d02db62c7f28c7909fd595c0db942917a3 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -366,6 +366,24 @@ static int read_and_act(struct active_array *a)
                 */
                if (sync_completed != 0)
                        a->last_checkpoint = sync_completed;
+               /* We might need to update last_checkpoint depending on
+                * the reason that reshape finished.
+                * if array reshape is really finished:
+                *        set check point to the end, this allows
+                *        set_array_state() to finalize reshape in metadata
+                * if reshape if broken: do not set checkpoint to the end
+                *        this allows for reshape restart from checkpoint
+                */
+               if ((a->curr_action != reshape) &&
+                   (a->prev_action == reshape)) {
+                       char buf[40];
+                       if ((sysfs_get_str(&a->info, NULL,
+                                         "reshape_position",
+                                         buf,
+                                         sizeof(buf)) >= 0) &&
+                            strncmp(buf, "none", 4) == 0)
+                               a->last_checkpoint = a->info.component_size;
+               }
                a->container->ss->set_array_state(a, a->curr_state <= clean);
                a->last_checkpoint = sync_completed;
        }