Grow: be more careful about metadata updates.

1/ When we sunc_metadata, we must reset ->update_tail else
   future metadata updates might go direct to the device bypassing
   mdmon.

2/ When converting to an array with redundancy so we can add disks
   it is neater to sync_metadata before starting mdmon rather that
   artificially setting update_tail early.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2010-12-16 09:07:51 +11:00
parent 885f984583
commit 76266030d6
1 changed files with 5 additions and 4 deletions

9
Grow.c
View File

@ -602,9 +602,10 @@ static int reshape_super(struct supertype *st, long long size, int level,
static void sync_metadata(struct supertype *st)
{
if (st->ss->external) {
if (st->update_tail)
if (st->update_tail) {
flush_metadata_updates(st);
else
st->update_tail = &st->updates;
} else
st->ss->sync_metadata(st);
}
}
@ -1495,7 +1496,6 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
goto release;
}
st->update_tail = &st->updates;
if (reshape_super(st, -1, UnSet, UnSet, 0, raid_disks,
backup_file, devname, !quiet)) {
rv = 1;
@ -1514,11 +1514,12 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
goto release;
}
sync_metadata(st);
if (!mdmon_running(st->devnum)) {
start_mdmon(st->devnum);
ping_monitor(container);
st->update_tail = &st->updates;
}
sync_metadata(st);
/* give mdmon a chance to allocate spares */
ping_manager(container);