From b8b286a639dd4ab19ace6f6c5dd092fbc3890276 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 31 Jan 2011 17:09:20 +1100 Subject: [PATCH] Make sure odisks is consistent between creating and using the fdlist reshape_prepare_fdlist and child_monitor currently have slightly different ideas of the 'old number of raid devices' which can cause major confusion. So settle on one value, and assign it to odisks early and always use it. Signed-off-by: NeilBrown --- Grow.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Grow.c b/Grow.c index 748fbf68..cdabce1f 100644 --- a/Grow.c +++ b/Grow.c @@ -1838,7 +1838,9 @@ started: /* Now we need to open all these devices so we can read/write. */ - nrdisks = array.raid_disks + sra->array.spare_disks; + nrdisks = max(reshape.before.data_disks, + reshape.after.data_disks) + reshape.parity + + sra->array.spare_disks; fdlist = malloc((1+nrdisks) * sizeof(int)); offsets = malloc((1+nrdisks) * sizeof(offsets[0])); if (!fdlist || !offsets) { @@ -1846,7 +1848,8 @@ started: goto release; } - d = reshape_prepare_fdlist(devname, sra, array.raid_disks, + odisks = reshape.before.data_disks + reshape.parity; + d = reshape_prepare_fdlist(devname, sra, odisks, nrdisks, blocks, backup_file, fdlist, offsets); if (d < 0) { @@ -1998,8 +2001,6 @@ started: fd = -1; mlockall(MCL_FUTURE); - odisks = reshape.before.data_disks + reshape.parity; - if (st->ss->external) { /* metadata handler takes it from here */ done = st->ss->manage_reshape( -- 2.39.2