From 76266030d68d35a2342b7d0f7517daa6401bc5af Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 16 Dec 2010 09:07:51 +1100 Subject: [PATCH] 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 --- Grow.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Grow.c b/Grow.c index af605a8..8322d2d 100644 --- a/Grow.c +++ b/Grow.c @@ -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);