Description of the bug: Interrupted reshape cannot be continued using incremental assembly. Array becomes inactive. Cause of the bug: Reshape tried to continue with insufficient number of disks added by incremental assembly (tested using capacity expansion). Solution: During reshape adding disks to array should be blocked until minimum required number of disks is ready to be added. Signed-off-by: Lukasz Dorau <lukasz.dorau@xxxxxxxxx> --- Assemble.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/Assemble.c b/Assemble.c index 25cfec1..da43162 100644 --- a/Assemble.c +++ b/Assemble.c @@ -1531,6 +1531,45 @@ int assemble_container_content(struct supertype *st, int mdfd, if (sra) sysfs_free(sra); + if (content->reshape_active) { + int disks_counter = 0; + int required_disks; + required_disks = content->array.raid_disks; + /* check if disks are removed */ + if (content->delta_disks < 0) + required_disks += content->delta_disks; + /* Count devices available for assemblation. + * In case of incremental assemblation during reshape + * allow to add disks only if required minimum number of disks + * is already collected to avoid assemblation problem. + * */ + for (dev = content->devs; dev; dev = dev->next) { + if (dev->disk.raid_disk >= 0) + disks_counter++; + } + /* allow for degradation */ + switch (content->array.level) { + case 6: + required_disks--; + case 4: + case 5: + required_disks--; + default: + break; + } + /* check now, if number of disks allows for assemblation + * */ + if (disks_counter < required_disks) { + if (verbose >= 0) + fprintf(stderr, Name + ": %s not assembled with %d devices " + "(required disks for assemblation: %i).\n", + chosen_name, disks_counter, + required_disks); + return 1; + } + block_subarray(content); + } old_raid_disks = content->array.raid_disks - content->delta_disks; for (dev = content->devs; dev; dev = dev->next) if (sysfs_add_disk(content, dev, 1) == 0) { --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. z siedziba w Gdansku ul. Slowackiego 173 80-298 Gdansk Sad Rejonowy Gdansk Polnoc w Gdansku, VII Wydzial Gospodarczy Krajowego Rejestru Sadowego, numer KRS 101882 NIP 957-07-52-316 Kapital zakladowy 200.000 zl This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ��.n��������+%������w��{.n�����{����w��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f