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/2] md/raid5: FIX: reshape on degraded devices has wrong configuration
Date: Mon, 17 Jan 2011 10:30:00 +1100	[thread overview]
Message-ID: <20110117103000.09a21d28@notabene.brown> (raw)
In-Reply-To: <20110114130007.15648.48487.stgit@gklab-128-013.igk.intel.com>

On Fri, 14 Jan 2011 14:00:08 +0100 Adam Kwolek <adam.kwolek@intel.com> wrote:

> When we performing expansion on degraded array (takeovered raid0),
> and we are adding i.e. 2 disks, one disk is added only.
> 
> this is due to fact that parity (missing) disk is moved to the end
> and added disk index is smaller than starting disk number in array.
> 
> To resolve this situation array degradation should be used for adding
> disk(s) on reshape start.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  drivers/md/raid5.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 59c4150..3b9da76 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -5528,7 +5528,8 @@ static int raid5_start_reshape(mddev_t *mddev)
>  		return -ENOSPC;
>  
>  	list_for_each_entry(rdev, &mddev->disks, same_set)
> -		if ((rdev->raid_disk < 0 || rdev->raid_disk >= conf->raid_disks)
> +		if ((rdev->raid_disk < 0 ||
> +		     rdev->raid_disk >= (conf->raid_disks - mddev->degraded))
>  		     && !test_bit(Faulty, &rdev->flags))
>  			spares++;
>  
> @@ -5589,7 +5590,8 @@ static int raid5_start_reshape(mddev_t *mddev)
>  					/* Failure here is OK */;
>  			} else
>  				break;
> -		} else if (rdev->raid_disk >= conf->previous_raid_disks
> +		} else if (rdev->raid_disk >= (conf->previous_raid_disks
> +						- mddev->degraded)
>  			   && !test_bit(Faulty, &rdev->flags)) {
>  			/* This is a spare that was manually added */
>  			if (raid5_add_disk(mddev, rdev) == 0) {

I see the problem you are trying to fix, but I think the fix is wrong.
The range check is correct, but the test for Faulty isn't quite right.
I think we need to check for In_sync and not Faulty, or something like that.
I work something out.

Thanks,
NeilBrown


  reply	other threads:[~2011-01-16 23:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14 12:59 [PATCH 0/2] fixes for manually-added spares in raid5 (2nd) Adam Kwolek
2011-01-14 13:00 ` [PATCH 1/2] md/raid5: FIX: manually-added spare is not used Adam Kwolek
2011-01-16 23:11   ` NeilBrown
2011-01-16 23:28     ` NeilBrown
2011-01-17  0:44       ` NeilBrown
2011-01-17 14:13         ` Kwolek, Adam
2011-01-19 20:48           ` NeilBrown
2011-01-20  8:29             ` Kwolek, Adam
2011-01-20  9:30               ` NeilBrown
2011-01-20  9:40                 ` Kwolek, Adam
2011-01-20 10:15                   ` NeilBrown
2011-01-14 13:00 ` [PATCH 2/2] md/raid5: FIX: reshape on degraded devices has wrong configuration Adam Kwolek
2011-01-16 23:30   ` NeilBrown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-01-14 12:38 [PATCH 0/2] fixes for manually-added spares in raid5 Adam Kwolek
2011-01-14 12:38 ` [PATCH 2/2] md/raid5: FIX: reshape on degraded devices has wrong configuration 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=20110117103000.09a21d28@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).