diff options
author | Shaohua Li <shli@fb.com> | 2015-09-18 13:20:13 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.com> | 2015-10-02 03:23:43 -0400 |
commit | ebda780bce8d58ec0abab157397c9e099c41a05f (patch) | |
tree | bb3995ca492ded73273329f69791cf814b5dfdbe | |
parent | 88724bfa68be792c1487d759e87568c36ac1a1cc (diff) |
raid5: update analysis state for failed stripe
handle_failed_stripe() makes the stripe fail, eg, all IO will return
with a failure, but it doesn't update stripe_head_state. Later
handle_stripe() has special handling for raid6 for handle_stripe_fill().
That check before handle_stripe_fill() doesn't skip the failed stripe
and we get a kernel crash in need_this_block. This patch clear the
analysis state to make sure no functions wrongly called after
handle_failed_stripe()
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
-rw-r--r-- | drivers/md/raid5.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 15ef2c641b2b..2105e5f1fd31 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3150,6 +3150,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, | |||
3150 | spin_unlock_irq(&sh->stripe_lock); | 3150 | spin_unlock_irq(&sh->stripe_lock); |
3151 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) | 3151 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) |
3152 | wake_up(&conf->wait_for_overlap); | 3152 | wake_up(&conf->wait_for_overlap); |
3153 | if (bi) | ||
3154 | s->to_read--; | ||
3153 | while (bi && bi->bi_iter.bi_sector < | 3155 | while (bi && bi->bi_iter.bi_sector < |
3154 | sh->dev[i].sector + STRIPE_SECTORS) { | 3156 | sh->dev[i].sector + STRIPE_SECTORS) { |
3155 | struct bio *nextbi = | 3157 | struct bio *nextbi = |
@@ -3169,6 +3171,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, | |||
3169 | */ | 3171 | */ |
3170 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 3172 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
3171 | } | 3173 | } |
3174 | s->to_write = 0; | ||
3175 | s->written = 0; | ||
3172 | 3176 | ||
3173 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) | 3177 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) |
3174 | if (atomic_dec_and_test(&conf->pending_full_writes)) | 3178 | if (atomic_dec_and_test(&conf->pending_full_writes)) |