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, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com, wojciech.neubauer@intel.com
Subject: Re: [PATCH 2/4] FIX: Cannot create volume
Date: Tue, 14 Jun 2011 12:35:30 +1000	[thread overview]
Message-ID: <20110614123530.319da13a@notabene.brown> (raw)
In-Reply-To: <20110609162921.690.90444.stgit@gklab-128-013.igk.intel.com>

On Thu, 09 Jun 2011 18:29:21 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:

> getinfo_super() can clear entire 'inf' structure before filling with new
> information. Disk number required later is lost.
> 
> Restore disk number information after getinfo_super() call.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  Create.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Create.c b/Create.c
> index 7b4d0fe..d01dea7 100644
> --- a/Create.c
> +++ b/Create.c
> @@ -805,7 +805,6 @@ int Create(struct supertype *st, char *mddev,
>  			switch(pass) {
>  			case 1:
>  				*inf = info;
> -
>  				inf->disk.number = dnum;
>  				inf->disk.raid_disk = dnum;
>  				if (inf->disk.raid_disk < raiddisks)
> @@ -856,12 +855,13 @@ int Create(struct supertype *st, char *mddev,
>  					/* getinfo_super might have lost these ... */
>  					inf->disk.major = major(stb.st_rdev);
>  					inf->disk.minor = minor(stb.st_rdev);
> +					inf->disk.number = dnum;
> +					inf->disk.raid_disk = dnum;
>  				}
>  				break;
>  			case 2:
>  				inf->errors = 0;
>  				rv = 0;
> -
>  				rv = add_disk(mdfd, st, &info, inf);
>  
>  				if (rv) {

Unfortunately this is wrong too.

There should be no need to set disk.number and disk.raid_disk as the
->getinfo_super is supposed to have set them.

As the comment in mdadm.h says:

	/* Extract generic details from metadata.  This could be details about
	 * the container, or about an individual array within the container.
	 * The determination is made either by:
	 *   load_super being given a 'component' string.
	 *   validate_geometry determining what to create.
	 * The info includes both array information and device information.
	 * The particular device should be:
	 *   The last device added by add_to_super
	 *   The device the metadata was loaded from by load_super
	 * If 'map' is present, then it is an array raid_disks long
	 * (raid_disk must already be set and correct) and it is filled
	 * with 1 for slots that are thought to be active and 0 for slots which
	 * appear to be failed/missing.
	 * *info is zeroed out before data is added.
	 */

In this case, ->add_to_super was recently called so it should record state so
that getinfo_super can return the correct information.  That is what super0
and super1 does.

It seems that this has been wrong for a long time and my recent change to
zero the info structure showed it up.
So I'll let the patch through so as not to hold things up unnecessarily, but
I would really like you to see if you can fix add_to_super and getinfo_super
so that they follow the documented behaviour.

Thanks,
NeilBrown

  reply	other threads:[~2011-06-14  2:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 16:29 [PATCH 0/4] IMSM Checkpointing Bug Fix Series (2) Adam Kwolek
2011-06-09 16:29 ` [PATCH 1/4] imsm: FIX: Cannot create volume Adam Kwolek
2011-06-14  2:07   ` NeilBrown
2011-06-14  9:21     ` Kwolek, Adam
2011-06-09 16:29 ` [PATCH 2/4] " Adam Kwolek
2011-06-14  2:35   ` NeilBrown [this message]
2011-06-09 16:29 ` [PATCH 3/4] imsm: FIX: Use function to obtain array layout Adam Kwolek
2011-06-09 16:29 ` [PATCH 4/4] imsm: FIX: Disable automatic metadata rollback for broken reshape Adam Kwolek

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=20110614123530.319da13a@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=wojciech.neubauer@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).