All of lore.kernel.org
 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] FIX: Close unused handle in child process during reshape restart
Date: Thu, 27 Oct 2011 15:50:48 +1100	[thread overview]
Message-ID: <20111027155048.719e8daf@notabene.brown> (raw)
In-Reply-To: <20111026161654.13887.42747.stgit@gklab-128-013.igk.intel.com>

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

On Wed, 26 Oct 2011 18:16:55 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:

> When array reshape (e.g. raid0->raid5 migration) is restarted during
> array assembly, file system placed on this array cannot be mounted until
> reshape is finished due to "busy" error.
> 
> This is caused when reshape is executed on array for external metadata
> and array handle is cloned /forked/ to child process environment but not
> closed.
> 
> Handle can't be closed before executing Grow_continue() because it is
> used later in code.
> 
> Close unused handle in child process /reshape_container()/.
> It is similar to close fd handle in reshape_array() before calling
> manage_reshape()/child_monitor() in Grow.c:2290.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  Grow.c |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index 0e4dd10..93a69fd 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -1350,6 +1350,7 @@ static int reshape_array(char *container, int fd, char *devname,
>  			 char *backup_file, int quiet, int forked,
>  			 int restart, int freeze_reshape);
>  static int reshape_container(char *container, char *devname,
> +			     int mdfd,
>  			     struct supertype *st, 
>  			     struct mdinfo *info,
>  			     int force,
> @@ -1768,7 +1769,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>  		 * number of devices (On-Line Capacity Expansion) must be
>  		 * performed at the level of the container
>  		 */
> -		rv = reshape_container(container, devname, st, &info,
> +		rv = reshape_container(container, devname, -1, st, &info,
>  				       force, backup_file, quiet, 0, 0);
>  		frozen = 0;
>  	} else {
> @@ -2403,7 +2404,10 @@ release:
>  	return 1;
>  }
>  
> +/* mdfd handle is passed to be closed in child process (after fork).
> + */
>  int reshape_container(char *container, char *devname,
> +		      int mdfd,
>  		      struct supertype *st, 
>  		      struct mdinfo *info,
>  		      int force,
> @@ -2446,6 +2450,11 @@ int reshape_container(char *container, char *devname,
>  		break;
>  	}
>  
> +	/* close unused handle in child process
> +	 */
> +	if (mdfd > -1)
> +		close(mdfd);
> +
>  	while(1) {
>  		/* For each member array with reshape_active,
>  		 * we need to perform the reshape.
> @@ -3821,7 +3830,7 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
>  		fmt_devname(container, st->container_dev);
>  		st->ss->load_container(st, cfd, container);
>  		close(cfd);
> -		ret_val = reshape_container(container, NULL,
> +		ret_val = reshape_container(container, NULL, mdfd,
>  					    st, info, 0, backup_file,
>  					    0, 1, freeze_reshape);
>  	} else
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



Applied, thanks.

NeilBrown

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

      reply	other threads:[~2011-10-27  4:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 16:16 [PATCH] FIX: Close unused handle in child process during reshape restart Adam Kwolek
2011-10-27  4:50 ` 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=20111027155048.719e8daf@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 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.