]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: be more careful about metadata updates.
authorNeilBrown <neilb@suse.de>
Wed, 15 Dec 2010 22:07:51 +0000 (09:07 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 15 Dec 2010 22:07:51 +0000 (09:07 +1100)
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>
Grow.c

diff --git a/Grow.c b/Grow.c
index af605a86f612c7bd29e4208e1d9081be735eeb6b..8322d2d74f96baedab477c121761c46a72f9b26f 100644 (file)
--- 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);