[lvm-devel] vgchange.c gets dmeventd monitoring activation wrong

Heinz Mauelshagen heinzm at redhat.com
Wed Mar 10 17:43:23 UTC 2010


Updating to Fedora 12 kernel 2.6.32.9-67.fc12.x86_64 I was left
with no root device.

Reason was, that we don't get dmeventd device monitoring activation
(deactivation in this case rather) right, hence causing dlopen on
libdevemapper-event DSO(s) via the dmeventd call chain.

The DSOs are intentionally not part of the initramfs for obvious
reasons, which should be respected by the fact, that we call "vgchange
--monitor n" from dracut's lvm_scan script.

This patch is a proposal to fix the dmeventd activation handling via the

"--ignoremonitoring" and the "--monitor {y|n}"

options and is not tested yet.

It give precedence to the "--ignoremonitoring" option over the other
one, which makes more sense IMO and needs a vgchange(8) manual change to
reflect this.
Of course we should better raise a command line error if both are given,
which is subject to future discussion.

Signed-off-by: Heinz Mauelshagen <heinzm at redhat.com>
---
 LVM2.2.02.53/tools/{vgchange.c.orig => vgchange.c} |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git LVM2.2.02.53/tools/vgchange.c.orig LVM2.2.02.53/tools/vgchange.c
index 95b0b48..e789cc4 100644
--- LVM2.2.02.53/tools/vgchange.c.orig
+++ LVM2.2.02.53/tools/vgchange.c
@@ -494,16 +494,24 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
 			   struct volume_group *vg,
 			   void *handle __attribute((unused)))
 {
-	int r = ECMD_FAILED;
+	int dmeventd_mode, r = ECMD_FAILED;
 
 	if (vg_is_exported(vg)) {
 		log_error("Volume group \"%s\" is exported", vg_name);
 		return ECMD_FAILED;
 	}
 
-	init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG,
-					    (is_static() || arg_count(cmd, ignoremonitoring_ARG)) ?
-					    DMEVENTD_MONITOR_IGNORE : DEFAULT_DMEVENTD_MONITOR));
+	/* Check conditions to activate dmeventd montoring. */
+	if (is_static())
+		dmeventd_mode = DMEVENTD_MONITOR_IGNORE;
+	else if (arg_count(cmd, ignoremonitoring_ARG))
+		dmeventd_mode = DMEVENTD_MONITOR_IGNORE;
+	else if (!arg_int_value(cmd, monitor_ARG, 1))
+		dmeventd_mode = DMEVENTD_MONITOR_IGNORE;
+	else
+		dmeventd_mode = DEFAULT_DMEVENTD_MONITOR;
+		
+	init_dmeventd_monitor(dmeventd_mode);
 
 	if (arg_count(cmd, available_ARG))
 		r = _vgchange_available(cmd, vg);





More information about the lvm-devel mailing list