linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, ed.ciechanowski@intel.com,
	marcin.labun@intel.com, dan.j.williams@intel.com
Subject: Re: [PATCH 3/3] FIX: Remove error message during reshape restart (v2)
Date: Mon, 3 Oct 2011 10:57:15 +1100	[thread overview]
Message-ID: <20111003105715.3a44923a@notabene.brown> (raw)
In-Reply-To: <20110929155353.22854.5948.stgit@gklab-128-013.igk.intel.com>

[-- Attachment #1: Type: text/plain, Size: 5140 bytes --]

On Thu, 29 Sep 2011 17:53:54 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:

> When reshape is started in container on single array, all other container
> members are blocked from monitoring also. After container reassembly
> we have to construct the same situation.
> Currently array under reshape is blocked only.
> 
> To block whole container during reshape we have 2 cases:
>   1. first assembled array is not reshaped and second is under reshape
>   2. first assembled array not reshaped and second is not under reshape
> 
> This patch addresses second case.
>   First assembled array is not reshaped and not blocked. Second reshaped
>   array is under reshape and it is blocked. When all reshaped array
>   parameters are verified and set in reshape continue freeze_container()
>   function block all other present in container and not blocked array(s).
> 
> This call to freeze_container() serves for native metadata case also.
> 
> This patch replaces its previous version that hides error message only.

I won't apply this one just now as it relates to the previous patch that I
want changed.
If you still think this is appropriate, please resubmit with the other fixes.

Thanks,

NeilBrown


> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  Grow.c |   18 +++++++++---------
>  msg.c  |   10 +++++++---
>  msg.h  |    2 +-
>  3 files changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index 3e13c8f..8f75ab8 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -566,8 +566,7 @@ int block_array_if_any_is_blocked(struct supertype *st, struct mdinfo *content)
>  	return 1;
>  }
>  
> -
> -static int freeze_container(struct supertype *st)
> +static int freeze_container(struct supertype *st, int restart)
>  {
>  	int container_dev = (st->container_dev != NoMdDev
>  			     ? st->container_dev : st->devnum);
> @@ -575,11 +574,12 @@ static int freeze_container(struct supertype *st)
>  
>  	if (!check_idle(st))
>  		return -1;
> -	
> +
>  	fmt_devname(container, container_dev);
>  
> -	if (block_monitor(container, 1)) {
> -		fprintf(stderr, Name ": failed to freeze container\n");
> +	if (block_monitor(container, 1, restart)) {
> +		if (!restart)
> +			fprintf(stderr, Name ": failed to freeze container\n");
>  		return -2;
>  	}
>  
> @@ -597,7 +597,7 @@ static void unfreeze_container(struct supertype *st)
>  	unblock_monitor(container, 1);
>  }
>  
> -static int freeze(struct supertype *st)
> +static int freeze(struct supertype *st, int restart)
>  {
>  	/* Try to freeze resync/rebuild on this array/container.
>  	 * Return -1 if the array is busy,
> @@ -606,7 +606,7 @@ static int freeze(struct supertype *st)
>  	 * return 1 if it worked.
>  	 */
>  	if (st->ss->external)
> -		return freeze_container(st);
> +		return freeze_container(st, restart);
>  	else {
>  		struct mdinfo *sra = sysfs_read(-1, st->devnum, GET_VERSION);
>  		int err;
> @@ -1522,7 +1522,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>  			devname);
>  		return 1;
>  	}
> -	frozen = freeze(st);
> +	frozen = freeze(st, 0);
>  	if (frozen < -1) {
>  		/* freeze() already spewed the reason */
>  		return 1;
> @@ -3653,7 +3653,7 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
>  	if (st->ss->external) {
>  		fmt_devname(buf, st->container_dev);
>  		container = buf;
> -		freeze(st);
> +		freeze(st, 1);
>  
>  		if (!mdmon_running(st->container_dev))
>  			start_mdmon(st->container_dev);
> diff --git a/msg.c b/msg.c
> index f903afb..48a5bc3 100644
> --- a/msg.c
> +++ b/msg.c
> @@ -334,7 +334,7 @@ int check_mdmon_version(char *container)
>   * As older versions of mdmon (which might run from initrd) don't understand
>   * this, we first check that the running mdmon is new enough.
>   */
> -int block_monitor(char *container, const int freeze)
> +int block_monitor(char *container, const int freeze, const int restart)
>  {
>  	struct mdstat_ent *ent, *e, *e2;
>  	struct mdinfo *sra = NULL;
> @@ -364,8 +364,12 @@ int block_monitor(char *container, const int freeze)
>  			break;
>  		}
>  		/* can't reshape an array that we can't monitor */
> -		if (sra->text_version[0] == '-')
> -			break;
> +		if (sra->text_version[0] == '-') {
> +			if (restart)
> +				continue;
> +			else
> +				break;
> +		}
>  
>  		if (freeze && sysfs_freeze_array(sra) < 1)
>  			break;
> diff --git a/msg.h b/msg.h
> index fb5815e..15aef2a 100644
> --- a/msg.h
> +++ b/msg.h
> @@ -30,7 +30,7 @@ extern int ping_monitor(char *devname);
>  extern int ping_monitor_by_id(int devnum);
>  extern int block_subarray(struct mdinfo *sra);
>  extern int unblock_subarray(struct mdinfo *sra, const int unfreeze);
> -extern int block_monitor(char *container, const int freeze);
> +extern int block_monitor(char *container, const int freeze, const int restart);
>  extern void unblock_monitor(char *container, const int unfreeze);
>  extern int check_blocked_monitor(char *container);
>  extern int fping_monitor(int sock);


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

      reply	other threads:[~2011-10-02 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29 15:53 [PATCH 0/3] Fix freezing multiple array in container during assembly Adam Kwolek
2011-09-29 15:53 ` [PATCH 1/3] Move code to check_mdmon_version() function Adam Kwolek
2011-10-02 23:45   ` NeilBrown
2011-09-29 15:53 ` [PATCH 2/3] FIX: Block array monitoring if any array is under reshape in container Adam Kwolek
2011-10-02 23:54   ` NeilBrown
2011-09-29 15:53 ` [PATCH 3/3] FIX: Remove error message during reshape restart (v2) Adam Kwolek
2011-10-02 23:57   ` NeilBrown [this message]

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=20111003105715.3a44923a@notabene.brown \
    --to=neilb@suse.de \
    --cc=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=marcin.labun@intel.com \
    /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).