linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adam Kwolek <adam.kwolek@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com, grzegorz.grabowski@intel.com,
	maciej.patelczyk@intel.com, anna.czarnowska@intel.com,
	Adam Kwolek <adam.kwolek@intel.com>
Subject: [PATCH 14/14] FIX: Assembled second array is in read only state during reshape
Date: Fri, 13 Apr 2012 16:52:08 +0200	[thread overview]
Message-ID: <1334328728-12544-15-git-send-email-adam.kwolek@intel.com> (raw)
In-Reply-To: <1334328728-12544-14-git-send-email-adam.kwolek@intel.com>

When arrays using external metadata are assembled, and one of array
in container is under reshape, second array will remain in read only
state (not auto read only). It is caused by array fact that array
is frozen and mdmon doesn't has opportunity to switch array in r/w mode.

Freezing not reshaped array just after it is being assembled allows mdmon
to enable it for writing.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---
 Assemble.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index 23695e7..080993d 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1558,6 +1558,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
 	int expansion = 0;
 	struct map_ent *map = NULL;
 	int old_raid_disks;
+	int start_reshape;
 
 	sysfs_init(content, mdfd, 0);
 
@@ -1569,7 +1570,17 @@ int assemble_container_content(struct supertype *st, int mdfd,
 			return 1;
 		}
 
-	if (st->ss->external && content->recovery_blocked)
+	/* There are two types of reshape: container wide or sub-array specific
+	 * Check if metadata requests blocking container wide reshapes
+	 */
+	start_reshape = (content->reshape_active &&
+		!((content->reshape_active == CONTAINER_RESHAPE) &&
+		(content->array.state & (1<<MD_SB_BLOCK_CONTAINER_RESHAPE))));
+
+	/* Block subarray here if it is under reshape now
+	 * Do not allow for any changes in this array
+	 */
+	if (st->ss->external && content->recovery_blocked && start_reshape)
 		block_subarray(content);
 
 	if (sra)
@@ -1595,14 +1606,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
 		 (working + preexist + expansion) >=
 			content->array.working_disks) {
 		int err;
-		int start_reshape;
 
-		/* There are two types of reshape: container wide or sub-array specific
-		 * Check if metadata requests blocking container wide reshapes
-		 */
-		start_reshape = (content->reshape_active &&
-				 !((content->reshape_active == CONTAINER_RESHAPE) &&
-				   (content->array.state & (1<<MD_SB_BLOCK_CONTAINER_RESHAPE))));
 		if (start_reshape) {
 			int spare = content->array.raid_disks + expansion;
 			if (restore_backup(st, content,
@@ -1646,6 +1650,15 @@ int assemble_container_content(struct supertype *st, int mdfd,
 		}
 		if (!err)
 			sysfs_set_safemode(content, content->safe_mode_delay);
+
+		/* Block subarray here if it is not reshaped now
+		 * It has be blocked a little later to allow mdmon to switch in
+		 * in to R/W state
+		 */
+		if (st->ss->external && content->recovery_blocked &&
+		    !start_reshape)
+			block_subarray(content);
+
 		if (verbose >= 0) {
 			if (err)
 				fprintf(stderr, Name
-- 
1.6.4.2


  reply	other threads:[~2012-04-13 14:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 14:51 [PATCH 00/14] imsm: volume expand Adam Kwolek
2012-04-13 14:51 ` [PATCH 01/14] imsm: FIX: Update function imsm_num_data_members() for Raid1/10 Adam Kwolek
2012-04-13 14:51   ` [PATCH 02/14] imsm: FIX: Add volume size expand support to imsm_analyze_change() Adam Kwolek
2012-04-13 14:51     ` [PATCH 03/14] imsm: Add new metadata update for volume size expansion Adam Kwolek
2012-04-13 14:51       ` [PATCH 04/14] imsm: Execute size change for external metatdata Adam Kwolek
2012-04-13 14:51         ` [PATCH 05/14] FIX: Support metadata changes rollback Adam Kwolek
2012-04-13 14:52           ` [PATCH 06/14] imsm: " Adam Kwolek
2012-04-13 14:52             ` [PATCH 07/14] FIX: Extend size of raid0 array Adam Kwolek
2012-04-13 14:52               ` [PATCH 08/14] FIX: Respect metadata size limitations Adam Kwolek
2012-04-13 14:52                 ` [PATCH 09/14] FIX: Detect error and rollback metadata Adam Kwolek
2012-04-13 14:52                   ` [PATCH 10/14] imsm: Add function imsm_get_free_size() Adam Kwolek
2012-04-13 14:52                     ` [PATCH 11/14] imsm: Support setting max size for size change operation Adam Kwolek
2012-04-13 14:52                       ` [PATCH 12/14] imsm: FIX: Component size alignment check Adam Kwolek
2012-04-13 14:52                         ` [PATCH 13/14] FIX: Size change is possible as standalone change only Adam Kwolek
2012-04-13 14:52                           ` Adam Kwolek [this message]
2012-04-17  2:52               ` [PATCH 07/14] FIX: Extend size of raid0 array NeilBrown
2012-04-19 15:09                 ` Dorau, Lukasz
2012-04-19 21:23                   ` NeilBrown
2012-04-20  8:48                     ` Dorau, Lukasz
2012-04-17  2:56 ` [PATCH 00/14] imsm: volume expand 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=1334328728-12544-15-git-send-email-adam.kwolek@intel.com \
    --to=adam.kwolek@intel.com \
    --cc=anna.czarnowska@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=grzegorz.grabowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=maciej.patelczyk@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).