All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] FIX: Cannot continue reshape if incremental assembly is used
@ 2011-09-01 13:18 Lukasz Dorau
  2011-09-06 21:34 ` Dan Williams
  0 siblings, 1 reply; 8+ messages in thread
From: Lukasz Dorau @ 2011-09-01 13:18 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, marcin.labun, ed.ciechanowski

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@intel.com>
---
 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.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-09-19  6:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AcxtYQevh8pgNQALRp+uJrxQ29o1Kg==>
2011-09-07 13:21 ` [PATCH] FIX: Cannot continue reshape if incremental assembly is used Dorau, Lukasz
2011-09-08  1:11   ` Williams, Dan J
2011-09-08  1:26     ` NeilBrown
     [not found]       ` <CABE8wwuheLbPA8JCJ0pw_nNOsWBWowHmLZ+piUOHXYcoFRtuHA@mail.gmail.com>
2011-09-19  6:40         ` NeilBrown
2011-09-01 13:18 Lukasz Dorau
2011-09-06 21:34 ` Dan Williams
2011-09-07  2:37   ` NeilBrown
2011-09-08  8:26     ` Dorau, Lukasz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.