diff options
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r-- | drivers/md/dm-raid1.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 4e1e04dbc4ab..9978b9f07fe9 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -737,15 +737,32 @@ out: | |||
737 | static void recovery_complete(int read_err, unsigned int write_err, | 737 | static void recovery_complete(int read_err, unsigned int write_err, |
738 | void *context) | 738 | void *context) |
739 | { | 739 | { |
740 | struct region *reg = (struct region *) context; | 740 | struct region *reg = (struct region *)context; |
741 | struct mirror_set *ms = reg->rh->ms; | ||
742 | int m, bit = 0; | ||
741 | 743 | ||
742 | if (read_err) | 744 | if (read_err) { |
743 | /* Read error means the failure of default mirror. */ | 745 | /* Read error means the failure of default mirror. */ |
744 | DMERR_LIMIT("Unable to read primary mirror during recovery"); | 746 | DMERR_LIMIT("Unable to read primary mirror during recovery"); |
747 | fail_mirror(get_default_mirror(ms), DM_RAID1_SYNC_ERROR); | ||
748 | } | ||
745 | 749 | ||
746 | if (write_err) | 750 | if (write_err) { |
747 | DMERR_LIMIT("Write error during recovery (error = 0x%x)", | 751 | DMERR_LIMIT("Write error during recovery (error = 0x%x)", |
748 | write_err); | 752 | write_err); |
753 | /* | ||
754 | * Bits correspond to devices (excluding default mirror). | ||
755 | * The default mirror cannot change during recovery. | ||
756 | */ | ||
757 | for (m = 0; m < ms->nr_mirrors; m++) { | ||
758 | if (&ms->mirror[m] == get_default_mirror(ms)) | ||
759 | continue; | ||
760 | if (test_bit(bit, &write_err)) | ||
761 | fail_mirror(ms->mirror + m, | ||
762 | DM_RAID1_SYNC_ERROR); | ||
763 | bit++; | ||
764 | } | ||
765 | } | ||
749 | 766 | ||
750 | rh_recovery_end(reg, !(read_err || write_err)); | 767 | rh_recovery_end(reg, !(read_err || write_err)); |
751 | } | 768 | } |