* [PATCH] md/raid5:When exec md_wait_for_blocked_rdev in ops_run_io,we must atomic_inc(&rdev->nr_pending).
@ 2012-06-11 3:23 majianpeng
2012-06-27 2:21 ` NeilBrown
0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2012-06-11 3:23 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid
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);
--
1.7.5.4
--------------
majianpeng
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] md/raid5:When exec md_wait_for_blocked_rdev in ops_run_io,we must atomic_inc(&rdev->nr_pending).
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
0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-06-27 2:21 UTC (permalink / raw)
To: majianpeng; +Cc: linux-raid
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-27 2:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).