Skip to contentSkip to conversation

master - RAID (lvconvert/dmeventd): Cleanly handle primary failure during 'recover' op

PATCH Jonathan Brassow 1 participant 1 message Jun 14, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4c0e908b0ac012a5517e61420ea1eccc6193c00a
Commit:        4c0e908b0ac012a5517e61420ea1eccc6193c00a
Parent:        d34d2068ddf20b7d683ee06205c31ec673b32813
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Wed Jun 14 08:39:50 2017 -0500
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Wed Jun 14 08:39:50 2017 -0500

RAID (lvconvert/dmeventd): Cleanly handle primary failure during 'recover' op

Add the checks necessary to distiguish the state of a RAID when the primary source for syncing fails during the "recover" process.

It has been possible to hit this condition before (like when converting from 2-way RAID1 to 3-way and having the first two devices die during the "recover" process). However, this condition is now more likely since we treat linear -> RAID1 conversions as "recover" now - so it is especially important we cleanly handle this condition.

---
 daemons/dmeventd/plugins/raid/dmeventd_raid.c |   16 +++++++
 lib/metadata/raid_manip.c                     |   60 +++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 0 deletions(-)
daemons/dmeventd/plugins/raid/dmeventd_raid.c +16 -0
index 4f204bf..afeac28 100644
@@ -58,6 +58,22 @@ static int _process_raid_event(struct dso_state *state, char *params, const char
 		dead = 1;
 	}
 
+	/*
+	 * if we are converting from non-RAID to RAID (e.g. linear -> raid1)
+	 * and too many original devices die, such that we cannot continue
+	 * the "recover" operation, the sync action will go to "idle", the
+	 * unsynced devs will remain at 'a', and the original devices will
+	 * NOT SWITCH TO 'D', but will remain at 'A' - hoping to be revived.
+	 *
+	 * This is simply the way the kernel works...
+	 */
+	if (!strcmp(status->sync_action, "idle") &&
+	    strchr(status->dev_health, 'a')) {
+		log_error("Primary sources for new RAID, %s, have failed.",
+			  device);
+		dead = 1; /* run it through LVM repair */
+	}
+
 	if (dead) {
 		if (status->insync_regions < status->total_regions) {
 			if (!state->warned) {
lib/metadata/raid_manip.c +60 -0

77 lines not on this page · raw message