summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-03-22 04:52:36 +0100
committerNeilBrown <neilb@suse.de>2011-03-22 04:52:36 +0100
commit0d5ac3c6efceaec95b47d734dcdaf4a5cd87bf57 (patch)
tree7eef5ed243b1778b01496be284d8fd10cda5ed8b /Grow.c
parentMonitor: handle v.quick removal of devices better. (diff)
downloadmdadm-0d5ac3c6efceaec95b47d734dcdaf4a5cd87bf57.tar.xz
mdadm-0d5ac3c6efceaec95b47d734dcdaf4a5cd87bf57.zip
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 <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r--Grow.c9
1 files changed, 9 insertions, 0 deletions
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) {