diff options
| -rw-r--r-- | drivers/md/dm-raid1.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index dee4221caa73..1a876f9965e0 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
| @@ -134,6 +134,7 @@ struct mirror_set { | |||
| 134 | /* recovery */ | 134 | /* recovery */ |
| 135 | region_t nr_regions; | 135 | region_t nr_regions; |
| 136 | int in_sync; | 136 | int in_sync; |
| 137 | int log_failure; | ||
| 137 | 138 | ||
| 138 | struct mirror *default_mirror; /* Default mirror */ | 139 | struct mirror *default_mirror; /* Default mirror */ |
| 139 | 140 | ||
| @@ -589,9 +590,9 @@ static void rh_recovery_end(struct region *reg, int success) | |||
| 589 | wake(rh->ms); | 590 | wake(rh->ms); |
| 590 | } | 591 | } |
| 591 | 592 | ||
| 592 | static void rh_flush(struct region_hash *rh) | 593 | static int rh_flush(struct region_hash *rh) |
| 593 | { | 594 | { |
| 594 | rh->log->type->flush(rh->log); | 595 | return rh->log->type->flush(rh->log); |
| 595 | } | 596 | } |
| 596 | 597 | ||
| 597 | static void rh_delay(struct region_hash *rh, struct bio *bio) | 598 | static void rh_delay(struct region_hash *rh, struct bio *bio) |
| @@ -892,12 +893,15 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes) | |||
| 892 | */ | 893 | */ |
| 893 | rh_inc_pending(&ms->rh, &sync); | 894 | rh_inc_pending(&ms->rh, &sync); |
| 894 | rh_inc_pending(&ms->rh, &nosync); | 895 | rh_inc_pending(&ms->rh, &nosync); |
| 895 | rh_flush(&ms->rh); | 896 | ms->log_failure = rh_flush(&ms->rh) ? 1 : 0; |
| 896 | 897 | ||
| 897 | /* | 898 | /* |
| 898 | * Dispatch io. | 899 | * Dispatch io. |
| 899 | */ | 900 | */ |
| 900 | while ((bio = bio_list_pop(&sync))) | 901 | if (unlikely(ms->log_failure)) |
| 902 | while ((bio = bio_list_pop(&sync))) | ||
| 903 | bio_endio(bio, bio->bi_size, -EIO); | ||
| 904 | else while ((bio = bio_list_pop(&sync))) | ||
| 901 | do_write(ms, bio); | 905 | do_write(ms, bio); |
| 902 | 906 | ||
| 903 | while ((bio = bio_list_pop(&recover))) | 907 | while ((bio = bio_list_pop(&recover))) |
