[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] Monitor LVs not at the top-level



Monitoring is done only for the top-level LV.
So if PV failure occurs during the mirror conversion,
the failure is not handled by dmeventd.

This patch fixes it by recursing for AREA_LV segments.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
monitor_dev_for_events(lv) is a function to start/stop monitoring
of each segment.
It's called for the top-level device on suspend/resume/activate/deactivate.
Since dm event is not propagated through the dm stack, it must explicitly
request monitoring of segments not in the top of the stack.

Without this patch, device failure during mirror upconversion is
not handled by dmeventd.

Index: LVM2.work/lib/activate/activate.c
===================================================================
--- LVM2.work.orig/lib/activate/activate.c
+++ LVM2.work/lib/activate/activate.c
@@ -679,6 +679,7 @@ int monitor_dev_for_events(struct cmd_co
 	struct list *tmp, *snh, *snht;
 	struct lv_segment *seg;
 	int (*monitor_fn) (struct lv_segment *s, int e);
+	uint32_t s;
 
 	/* skip dmeventd code altogether */
 	if (dmeventd_monitor_mode() == DMEVENTD_MONITOR_IGNORE)
@@ -715,6 +716,19 @@ int monitor_dev_for_events(struct cmd_co
 	list_iterate(tmp, &lv->segments) {
 		seg = list_item(tmp, struct lv_segment);
 
+		/* Recurse for AREA_LV */
+		for (s = 0; s < seg->area_count; s++) {
+			if (seg_type(seg, s) != AREA_LV)
+				continue;
+			if (!monitor_dev_for_events(cmd, seg_lv(seg, s),
+						    monitor)) {
+				log_error("Failed to %smonitor %s",
+					  monitor ? "" : "un",
+					  seg_lv(seg, s)->name);
+				r = 0;
+			}
+		}
+
 		if (!seg_monitored(seg) || (seg->status & PVMOVE))
 			continue;
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]