From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH] md/raid5:When exec md_wait_for_blocked_rdev in ops_run_io,we must atomic_inc(&rdev->nr_pending).
Date: Wed, 27 Jun 2012 12:21:29 +1000 [thread overview]
Message-ID: <20120627122129.720f6021@notabene.brown> (raw)
In-Reply-To: <201206111123534849890@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
On Mon, 11 Jun 2012 11:23:56 +0800 majianpeng <majianpeng@gmail.com> wrote:
> In ops_run_io(), if call md_wait_for_blocked_rdev which it dec
> nr_pending, the rdev->nr_pending will dec again in else-statement.
> So the nr_penging is error and we can't remove this device.
>
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
> drivers/md/raid5.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index d267672..995b2de 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -607,6 +607,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
> md_check_recovery(conf->mddev);
> }
> md_wait_for_blocked_rdev(rdev, conf->mddev);
> + /*
> + * Because md_wait_for_blocked_rdev will dec
> + * nr_pending,we must add.The real dec is in
> + * else statement.
> + */
> + atomic_inc(&rdev->nr_pending);
> } else {
> /* Acknowledged bad block - skip the write */
> rdev_dec_pending(rdev, conf->mddev);
Thanks for catching this.
I have moved the 'atomic_inc' to before 'md_wait_for_blocked_rdev'
to make sure that the nr_pending count never goes to zero, and I tidied
up the comment a little.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2012-06-27 2:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-11 3:23 [PATCH] md/raid5:When exec md_wait_for_blocked_rdev in ops_run_io,we must atomic_inc(&rdev->nr_pending) majianpeng
2012-06-27 2:21 ` 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=20120627122129.720f6021@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.