From: NeilBrown Date: Tue, 22 Mar 2011 03:52:36 +0000 (+1100) Subject: Grow: increase raid_disks before adding specific spares. X-Git-Tag: mdadm-3.2.1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d5ac3c6efceaec95b47d734dcdaf4a5cd87bf57;p=thirdparty%2Fmdadm.git Grow: increase raid_disks before adding specific spares. When we add spared that have been targeted at a specific slot, we need raid_disks to be bigger than the slot number. But currently we don't increase raid_disks until after we add these spares. So introduce an early increase of raid_disks to allow the spares to be added. Signed-off-by: NeilBrown --- diff --git a/Grow.c b/Grow.c index b6395850..d6ecde2d 100644 --- a/Grow.c +++ b/Grow.c @@ -1786,6 +1786,15 @@ static int reshape_array(char *container, int fd, char *devname, if (info2) { sysfs_init(info2, fd, st->devnum); + /* When increasing number of devices, we need to set + * new raid_disks before adding these, or they might + * be rejected. + */ + if (reshape.backup_blocks && + reshape.after.data_disks > reshape.before.data_disks) + subarray_set_num(container, info2, "raid_disks", + reshape.after.data_disks + + reshape.parity); for (d = info2->devs; d; d = d->next) { if (d->disk.state == 0 && d->disk.raid_disk >= 0) {