The patch below does not apply to the 3.0-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From 1850753d2e6d9ca7856581ca5d3cf09521e6a5d7 Mon Sep 17 00:00:00 2001
From: majianpeng <majianp...@gmail.com>
Date: Tue, 3 Jul 2012 12:11:54 +1000
Subject: [PATCH] md/raid5: In ops_run_io, inc nr_pending before calling
 md_wait_for_blocked_rdev

In ops_run_io(), the call to md_wait_for_blocked_rdev will decrement
nr_pending so we lose the reference we hold on the rdev.
So atomic_inc it first to maintain the reference.

This bug was introduced by commit  73e92e51b7969ef5477d
    md/raid5.  Don't write to known bad block on doubtful devices.

which appeared in 3.0, so patch is suitable for stable kernels since
then.

Cc: stable@vger.kernel.org
Signed-off-by: majianpeng <majianp...@gmail.com>
Signed-off-by: NeilBrown <ne...@suse.de>

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 9567a9c..befadb4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -606,6 +606,12 @@ static void ops_run_io(struct stripe_head *sh, struct 
stripe_head_state *s)
                                         * a chance*/
                                        md_check_recovery(conf->mddev);
                                }
+                               /*
+                                * Because md_wait_for_blocked_rdev
+                                * will dec nr_pending, we must
+                                * increment it first.
+                                */
+                               atomic_inc(&rdev->nr_pending);
                                md_wait_for_blocked_rdev(rdev, conf->mddev);
                        } else {
                                /* Acknowledged bad block - skip the write */

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to