]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: don't try to use 'raid_disks' value for a container.
authorNeilBrown <neilb@suse.de>
Wed, 9 Mar 2011 07:50:59 +0000 (18:50 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 9 Mar 2011 07:50:59 +0000 (18:50 +1100)
The 'raid_disks' for a container is zero, so subtracting it
from the given raid_disks to get delta_disks doesn't make sense.

Rather set delta_disks to UnSet and set raid_disks to the requested
number of disks.   This then gets passed to reshape_super() which
can use it as required.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 32263b0da8a249208c0fc5b8aaa2e73c51b656ac..e9327226079485ba875b111f2cde3d662413488b 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1506,7 +1506,10 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
        info.component_size = size*2;
        info.new_level = level;
        info.new_chunk = chunksize * 1024;
-       if (raid_disks)
+       if (info.array.level == LEVEL_CONTAINER) {
+               info.delta_disks = UnSet;
+               info.array.raid_disks = raid_disks;
+       } else if (raid_disks)
                info.delta_disks = raid_disks - info.array.raid_disks;
        else
                info.delta_disks = UnSet;