All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Dorau <lukasz.dorau@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, marcin.labun@intel.com,
	ed.ciechanowski@intel.com
Subject: [PATCH] FIX: Cannot continue reshape if incremental assembly is used
Date: Thu, 01 Sep 2011 15:18:39 +0200	[thread overview]
Message-ID: <20110901131839.3293.49295.stgit@gklab-128-085.igk.intel.com> (raw)

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.

             reply	other threads:[~2011-09-01 13:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 13:18 Lukasz Dorau [this message]
2011-09-06 21:34 ` [PATCH] FIX: Cannot continue reshape if incremental assembly is used Dan Williams
2011-09-07  2:37   ` NeilBrown
2011-09-08  8:26     ` Dorau, Lukasz
     [not found] <AcxtYQevh8pgNQALRp+uJrxQ29o1Kg==>
2011-09-07 13:21 ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110901131839.3293.49295.stgit@gklab-128-085.igk.intel.com \
    --to=lukasz.dorau@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=marcin.labun@intel.com \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.