]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: Array after takeover has to be frozen
authorAdam Kwolek <adam.kwolek@intel.com>
Wed, 26 Jan 2011 15:03:41 +0000 (16:03 +0100)
committerNeilBrown <neilb@suse.de>
Fri, 28 Jan 2011 00:26:15 +0000 (10:26 +1000)
Problem occurs when we want to expand single disk raid0 array.
This is done via degraded 2 disks raid4 array. When new spare
is added to array, md immediately initiates recovery before
mdadm can configure and start reshape. This is due fact that 2 disk
raid4/5 array is special md case. Mdmon does nothing here because
container is blocked.
Put array in to frozen state allows mdadm to finish configuration
before reshape is executed in md.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index d79e229776cc7251171cb7b756b54174caa2f6a0..958febf40cb34b2eb34e040426a8f2e029fe032d 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1632,6 +1632,12 @@ static int reshape_array(char *container, int fd, char *devname,
                        return 0;
                goto started;
        }
+       /* The container is frozen but the array may not be.
+        * So freeze the array so spares don't get put to the wrong use
+        * FIXME there should probably be a cleaner separation between
+        * freeze_array and freeze_container.
+        */
+       sysfs_freeze_array(info);
        spares_needed = max(reshape.before.data_disks,
                            reshape.after.data_disks)
                + reshape.parity - array.raid_disks;