]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: Check correct 'old' level to see if reshape is needed.
authorAdam Kwolek <adam.kwolek@intel.com>
Tue, 8 Mar 2011 12:24:55 +0000 (13:24 +0100)
committerNeilBrown <neilb@suse.de>
Wed, 9 Mar 2011 07:42:40 +0000 (18:42 +1100)
Normally when reshape_array is called with restart == 0,
info->array is the same as the 'array' read from the kernel
(via ioctl) so both have the same level.

However when called from reshape_container, info->array was
generated by the metadata so it will have 'level' set to the
intermediate (or final) level already.

So to test if we need to change the level, we need to compare the
desired level with that which was loaded from the kernel (array.level)
rather than that which was read from metadata (info->array.level).

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 2c99924bf9a011c631ce714315ed6399f401cf48..ecbc837e7013f10882761c80d98affead9c79e75 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1707,7 +1707,7 @@ static int reshape_array(char *container, int fd, char *devname,
                goto release;
        }
 
-       if (reshape.level != info->array.level) {
+       if (reshape.level != array.level) {
                char *c = map_num(pers, reshape.level);
                int err;
                if (c == NULL)
@@ -1727,7 +1727,7 @@ static int reshape_array(char *container, int fd, char *devname,
                if (!quiet)
                        fprintf(stderr, Name ": level of %s changed to %s\n",
                                devname, c);    
-               orig_level = info->array.level;
+               orig_level = array.level;
                sysfs_freeze_array(info);
 
                if (reshape.level > 0 && st->ss->external) {