All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: md/raid5:Fix a bug about judging the operation is syncing or replaing in analyse_stripe().
Date: Mon, 2 Apr 2012 11:17:56 +1000	[thread overview]
Message-ID: <20120402111756.5b7c0bae@notabene.brown> (raw)
In-Reply-To: <201203291122488286296@gmail.com>

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

On Thu, 29 Mar 2012 11:22:52 +0800 "majianpeng" <majianpeng@gmail.com> wrote:

> >From 4d79586ebffac308ba11b363d81525882fdf6abe Mon Sep 17 00:00:00 2001
> From: majianpeng <majianpeng@gmail.com>
> Date: Thu, 29 Mar 2012 11:12:59 +0800
> Subject: [PATCH] md/raid5:Fix a bug about judging the operation is syncing or
>  replaing in analyse_stripe().
> 
> When create a raid5 using assume-clean and echo check or repair to
> sync_action.Then component disks did not operated IO but the raid
> check/resync faster than normal.
> Because the judgement in function analyse_stripe():
> 		if (do_recovery ||
> 		    sh->sector >= conf->mddev->recovery_cp)
> 			s->syncing = 1;
> 		else
> 			s->replacing = 1;
> When check or repair,the recovery_cp == MaxSectore,so syncing equal zero
> not one.

Thanks for the detailed description!

This fixes a bug in 3.3 so I'll queue it for 3.3-stable.

Thanks,
NeilBrown


> 
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
>  drivers/md/raid5.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 23ac880..4d43ad3 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -3276,12 +3276,14 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
>  		/* If there is a failed device being replaced,
>  		 *     we must be recovering.
>  		 * else if we are after recovery_cp, we must be syncing
> +		 * else if MD_RECOVERY_REQUESTED is set,we all in syning.
>  		 * else we can only be replacing
>  		 * sync and recovery both need to read all devices, and so
>  		 * use the same flag.
>  		 */
>  		if (do_recovery ||
> -		    sh->sector >= conf->mddev->recovery_cp)
> +		    sh->sector >= conf->mddev->recovery_cp ||
> +		    test_bit(MD_RECOVERY_REQUESTED, &(conf->mddev->recovery)))
>  			s->syncing = 1;
>  		else
>  			s->replacing = 1;


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

      reply	other threads:[~2012-04-02  1:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29  3:22 md/raid5:Fix a bug about judging the operation is syncing or replaing in analyse_stripe() majianpeng
2012-04-02  1:17 ` 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=20120402111756.5b7c0bae@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=majianpeng@gmail.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.