From a9c3e78fdd02abd0738bccbbb10d3a08deda1d2c Mon Sep 17 00:00:00 2001 From: Adam Kwolek Date: Wed, 26 Jan 2011 16:03:41 +0100 Subject: [PATCH] FIX: Array after takeover has to be frozen 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 Signed-off-by: NeilBrown --- Grow.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Grow.c b/Grow.c index d79e229..958febf 100644 --- 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;