aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-10-10 22:50:12 -0400
committerNeilBrown <neilb@suse.de>2012-10-10 22:50:12 -0400
commit143c4d0573caebe0ae017097614349697e2280eb (patch)
treeb5a68ce2a375a8e2617d2f4099b1701b521ddcc8 /drivers/md
parent9e44476851e91c86c98eb92b9bc27fb801f89072 (diff)
md/raid5: add some missing locking in handle_failed_stripe.
We really should hold the stripe_lock while accessing 'toread' else we could race with add_stripe_bio and corrupt a list. Reported-by: "Jianpeng Ma" <majianpeng@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 758b77296404..36c0a158730b 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2552,8 +2552,10 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
2552 if (!test_bit(R5_Wantfill, &sh->dev[i].flags) && 2552 if (!test_bit(R5_Wantfill, &sh->dev[i].flags) &&
2553 (!test_bit(R5_Insync, &sh->dev[i].flags) || 2553 (!test_bit(R5_Insync, &sh->dev[i].flags) ||
2554 test_bit(R5_ReadError, &sh->dev[i].flags))) { 2554 test_bit(R5_ReadError, &sh->dev[i].flags))) {
2555 spin_lock_irq(&sh->stripe_lock);
2555 bi = sh->dev[i].toread; 2556 bi = sh->dev[i].toread;
2556 sh->dev[i].toread = NULL; 2557 sh->dev[i].toread = NULL;
2558 spin_unlock_irq(&sh->stripe_lock);
2557 if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) 2559 if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags))
2558 wake_up(&conf->wait_for_overlap); 2560 wake_up(&conf->wait_for_overlap);
2559 if (bi) s->to_read--; 2561 if (bi) s->to_read--;