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

[lvm-devel] [PATCH] Propagate DMEVENTD_MONITOR_IGNORE to clvmd



Hi,

when I removed recursive calls from dmeventd to itself, I have relied on
DMEVENTD_MONITOR_IGNORE to block LVM commands from talking to
dmeventd. However, the implementation of DMEVENTD_MONITOR_IGNORE is
incorrect whenever clvmd is involved: clvmd will force monitoring off on
all volumes whenever DMEVENTD_MONITOR_IGNORE is used with current code.

This patch makes it possible to keep clvmd from touching dmeventd,
fixing the implementation of DMEVENTD_MONITOR_IGNORE and therefore also
dmeventd behaviour with locking_type 3.

The new locking flag should have no effect on older instances of clvmd
(in other words, these will still shut down monitoring whenever
--ignoremonitoring, or its equivalent used by dmeventd, is used). Old
LVM talking to new clvmd will behave as if --ignoremonitoring was always
in effect (which is probably still better than disabling monitoring on
unsuspecting users).

Petr

Index: daemons/clvmd/lvm-functions.c
===================================================================
RCS file: /cvs/lvm2/LVM2/daemons/clvmd/lvm-functions.c,v
retrieving revision 1.125
diff -u -p -r1.125 lvm-functions.c
--- daemons/clvmd/lvm-functions.c	27 Sep 2011 22:43:40 -0000	1.125
+++ daemons/clvmd/lvm-functions.c	27 Nov 2011 21:07:10 -0000
@@ -132,13 +132,14 @@ static const char *decode_flags(unsigned
 	static char buf[128];
 	int len;
 
-	len = sprintf(buf, "0x%x ( %s%s%s%s%s%s)", flags,
+	len = sprintf(buf, "0x%x ( %s%s%s%s%s%s%s)", flags,
 		flags & LCK_PARTIAL_MODE	  ? "PARTIAL_MODE|" : "",
 		flags & LCK_MIRROR_NOSYNC_MODE	  ? "MIRROR_NOSYNC|" : "",
 		flags & LCK_DMEVENTD_MONITOR_MODE ? "DMEVENTD_MONITOR|" : "",
 		flags & LCK_ORIGIN_ONLY_MODE ? "ORIGIN_ONLY|" : "",
 		flags & LCK_TEST_MODE ? "TEST|" : "",
-		flags & LCK_CONVERT ? "CONVERT|" : "");
+		flags & LCK_CONVERT ? "CONVERT|" : "",
+		flags & LCK_CALL_DMEVENTD ? "CALL_DMEVENTD|" : "");
 
 	if (len > 1)
 		buf[len - 2] = ' ';
@@ -512,10 +513,13 @@ int do_lock_lv(unsigned char command, un
 	if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
 		init_mirror_in_sync(1);
 
-	if (lock_flags & LCK_DMEVENTD_MONITOR_MODE)
-		init_dmeventd_monitor(1);
-	else
-		init_dmeventd_monitor(0);
+	if (lock_flags & LCK_CALL_DMEVENTD) {
+		if (lock_flags & LCK_DMEVENTD_MONITOR_MODE)
+			init_dmeventd_monitor(1);
+		else
+			init_dmeventd_monitor(0);
+	} else
+		init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE);
 
 	cmd->partial_activation = (lock_flags & LCK_PARTIAL_MODE) ? 1 : 0;
 
Index: lib/locking/cluster_locking.c
===================================================================
RCS file: /cvs/lvm2/LVM2/lib/locking/cluster_locking.c,v
retrieving revision 1.60
diff -u -p -r1.60 cluster_locking.c
--- lib/locking/cluster_locking.c	21 Oct 2011 15:49:45 -0000	1.60
+++ lib/locking/cluster_locking.c	27 Nov 2011 21:07:15 -0000
@@ -341,7 +341,10 @@ static int _lock_for_cluster(struct cmd_
 	 * But DMEVENTD_MONITOR_IGNORE is not propagated across the cluster.
 	 */
 	dmeventd_mode = dmeventd_monitor_mode();
-	if (dmeventd_mode != DMEVENTD_MONITOR_IGNORE && dmeventd_mode)
+	if (dmeventd_mode != DMEVENTD_MONITOR_IGNORE)
+		args[1] |= LCK_CALL_DMEVENTD;
+
+	if (dmeventd_mode)
 		args[1] |= LCK_DMEVENTD_MONITOR_MODE;
 
 	if (cmd->partial_activation)
Index: lib/locking/locking.h
===================================================================
RCS file: /cvs/lvm2/LVM2/lib/locking/locking.h,v
retrieving revision 1.69
diff -u -p -r1.69 locking.h
--- lib/locking/locking.h	27 Sep 2011 22:43:41 -0000	1.69
+++ lib/locking/locking.h	27 Nov 2011 21:07:16 -0000
@@ -109,6 +109,7 @@ int check_lvm1_vg_inactive(struct cmd_co
 #define LCK_ORIGIN_ONLY_MODE		0x20	/* Same as above */
 #define LCK_TEST_MODE			0x10    /* Test mode: No activation */
 #define LCK_REVERT_MODE			0x40	/* Remove inactive tables */
+#define LCK_CALL_DMEVENTD		0x80	/* Whether to call dmeventd */
 
 /*
  * Special cases of VG locks.

-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined

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