From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH] md/raid5:Add "BlockedBadBlocks" flag when waitting rdev to be unlocked.
Date: Wed, 27 Jun 2012 13:45:13 +1000 [thread overview]
Message-ID: <20120627134513.2a67fbb0@notabene.brown> (raw)
In-Reply-To: <201206181113442039690@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2680 bytes --]
On Mon, 18 Jun 2012 11:13:48 +0800 majianpeng <majianpeng@gmail.com> wrote:
> If rdev became blocked because the unack badblocks, it did not exec
> md_wait_for_blocked_rdev in handle_stripe().So the rdev->nr_pending did
> not decrease.So rdev did not remove because the wrong nr_pending.
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
> drivers/md/raid5.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index d267672..ed63261 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -3582,7 +3582,8 @@ static void handle_stripe(struct stripe_head *sh)
>
> finish:
> /* wait for this device to become unblocked */
> - if (conf->mddev->external && unlikely(s.blocked_rdev))
> + if (unlikely(s.blocked_rdev) && (conf->mddev->external ||
> + test_bit(BlockedBadBlocks, &(s.blocked_rdev->flags))))
> md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev);
>
> if (s.handle_bad_blocks)
Thanks for finding this. However I don't think your patch is quite correct.
It would re-introduce a hang fixed by commit 43220aa0f22cd3ce5b3.
I've applied the following instead.
Thanks,
NeilBrown
From 0cee6aeb02b1ef947be62bb455f64720ecba2b4c Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Wed, 27 Jun 2012 13:43:54 +1000
Subject: [PATCH] md/raid5: fix refcount problem when blocked_rdev is set.
commit 43220aa0f22cd3ce5b30246d50ccd696d119edea
md/raid5: fix a hang on device failure.
fixed a hang, but introduced a refcounting in balance so
that if the presence of bad-blocks ever caused an rdev to
be 'blocked' we would increment the refcount on the rdev and
never decrement it.
So added the needed rdev_dec_pending when md_wait_for_blocked_rdev
is not called.
Reported-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index befadb4..e23cd59 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3588,8 +3588,17 @@ static void handle_stripe(struct stripe_head *sh)
finish:
/* wait for this device to become unblocked */
- if (conf->mddev->external && unlikely(s.blocked_rdev))
- md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev);
+ if (unlikely(s.blocked_rdev)) {
+ if (conf->mddev->external)
+ md_wait_for_blocked_rdev(s.blocked_rdev,
+ conf->mddev);
+ else
+ /* Internal metadata will immediately
+ * be written by raid5d, so we don't
+ * need to wait here.
+ */
+ rdev_dec_pending(rdev, mddev);
+ }
if (s.handle_bad_blocks)
for (i = disks; i--; ) {
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2012-06-27 3:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 3:13 [PATCH] md/raid5:Add "BlockedBadBlocks" flag when waitting rdev to be unlocked majianpeng
2012-06-27 3:45 ` NeilBrown [this message]
2012-06-27 3:55 ` NeilBrown
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=20120627134513.2a67fbb0@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 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).