FIX: Last checkpoint is not set

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>
This commit is contained in:
Adam Kwolek 2011-02-03 17:34:27 +11:00 committed by NeilBrown
parent 5e7b033066
commit 6d4225a131
1 changed files with 18 additions and 0 deletions

View File

@ -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;
}