aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authormajianpeng <majianpeng@gmail.com>2012-07-02 22:11:54 -0400
committerNeilBrown <neilb@suse.de>2012-07-02 22:11:54 -0400
commit1850753d2e6d9ca7856581ca5d3cf09521e6a5d7 (patch)
tree78b6a6f246d35b13c3a37461187be7453d0972ba /drivers/md
parent6c0544e255dd6582a9899572e120fb55d9f672a4 (diff)
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 <majianpeng@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 9567a9c83a1f..befadb41a11f 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)
606 * a chance*/ 606 * a chance*/
607 md_check_recovery(conf->mddev); 607 md_check_recovery(conf->mddev);
608 } 608 }
609 /*
610 * Because md_wait_for_blocked_rdev
611 * will dec nr_pending, we must
612 * increment it first.
613 */
614 atomic_inc(&rdev->nr_pending);
609 md_wait_for_blocked_rdev(rdev, conf->mddev); 615 md_wait_for_blocked_rdev(rdev, conf->mddev);
610 } else { 616 } else {
611 /* Acknowledged bad block - skip the write */ 617 /* Acknowledged bad block - skip the write */