Commit 8f0205b7 authored by Jonathan Brassow's avatar Jonathan Brassow Committed by Alasdair G Kergon

dm raid1: handle recovery failures

This patch adds the calls to 'fail_mirror' if an error occurs during
mirror recovery (aka resynchronization).  'fail_mirror' is responsible
for recording the type of error by mirror device and ensuring an event
gets raised for the purpose of notifying userspace.
Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 72f4b314
...@@ -737,15 +737,32 @@ static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type) ...@@ -737,15 +737,32 @@ static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type)
static void recovery_complete(int read_err, unsigned int write_err, static void recovery_complete(int read_err, unsigned int write_err,
void *context) void *context)
{ {
struct region *reg = (struct region *) context; struct region *reg = (struct region *)context;
struct mirror_set *ms = reg->rh->ms;
int m, bit = 0;
if (read_err) if (read_err) {
/* Read error means the failure of default mirror. */ /* Read error means the failure of default mirror. */
DMERR_LIMIT("Unable to read primary mirror during recovery"); DMERR_LIMIT("Unable to read primary mirror during recovery");
fail_mirror(get_default_mirror(ms), DM_RAID1_SYNC_ERROR);
}
if (write_err) if (write_err) {
DMERR_LIMIT("Write error during recovery (error = 0x%x)", DMERR_LIMIT("Write error during recovery (error = 0x%x)",
write_err); write_err);
/*
* Bits correspond to devices (excluding default mirror).
* The default mirror cannot change during recovery.
*/
for (m = 0; m < ms->nr_mirrors; m++) {
if (&ms->mirror[m] == get_default_mirror(ms))
continue;
if (test_bit(bit, &write_err))
fail_mirror(ms->mirror + m,
DM_RAID1_SYNC_ERROR);
bit++;
}
}
rh_recovery_end(reg, !(read_err || write_err)); rh_recovery_end(reg, !(read_err || write_err));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment