FIX: Last checkpoint is not initialized on reshape restart
When reshape is restarted and active array in mdmon is being initialized, mdmon has to know last checkpoint, otherwise reshape will be restarted form '0' position. mdadm when reshaped array is assembled stores reshape_position in sysfs and runs mdmon. Initialize last_checkpoint in active array structure to value present in sysfs for reshaped array start. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
bcc9e9edd0
commit
138477db4b
15
managemon.c
15
managemon.c
|
@ -596,6 +596,7 @@ static void manage_new(struct mdstat_ent *mdstat,
|
|||
char *inst;
|
||||
int i;
|
||||
int failed = 0;
|
||||
char buf[40];
|
||||
|
||||
/* check if array is ready to be monitored */
|
||||
if (!mdstat->active)
|
||||
|
@ -657,6 +658,20 @@ static void manage_new(struct mdstat_ent *mdstat,
|
|||
dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst),
|
||||
new->action_fd, new->info.state_fd);
|
||||
|
||||
/* reshape_position is set by mdadm in sysfs
|
||||
* read this information for new arrays only (empty victim)
|
||||
*/
|
||||
if ((victim == NULL) &&
|
||||
(sysfs_get_str(mdi, NULL, "sync_action", buf, 40) > 0) &&
|
||||
(strncmp(buf, "reshape", 7) == 0)) {
|
||||
if (sysfs_get_ll(mdi, NULL, "reshape_position",
|
||||
&new->last_checkpoint) != 0)
|
||||
new->last_checkpoint = 0;
|
||||
dprintf("mdmon: New monitored array is under reshape.\n"
|
||||
" Last checkpoint is: %llu\n",
|
||||
new->last_checkpoint);
|
||||
}
|
||||
|
||||
sysfs_free(mdi);
|
||||
|
||||
/* if everything checks out tell the metadata handler we want to
|
||||
|
|
Loading…
Reference in New Issue