vgchange.c gets dmeventd monitoring activation wrong
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.
---
LVM2.2.02.53/tools/{vgchange.c.orig => vgchange.c} | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)tools/vgchange.c renamed from tools/vgchange.c.orig +12 -4
@@ -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);
Next version rejecting both monitoring flags being provided.
Quoted 15 lines · Heinz Mauelshagen
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_scanscript.This patch is a proposal to fix the dmeventd activation handling via the
"--ignoremonitoring" and the "--monitor {y|n}"
Quoted 7 lines
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.
---
LVM2.2.02.53/tools/{vgchange.c.orig => vgchange.c} | 22 ++++++++++++++++---
1 files changed, 18 insertions(+), 4 deletions(-)tools/vgchange.c renamed from tools/vgchange.c.orig +18 -4
@@ -494,16 +494,30 @@ 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 )); +if (arg_count (cmd, ignoremonitoring_ARG) && +arg_count (cmd, monitor_ARG)) { +log_error ("Can't specify both monitoring flags" ); +return ECMD_FAILED ; + } + +/* 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);
Got the setting in case "--monitor {y|n}" got provided wrong. See next patch below.
Quoted 25 lines · Heinz Mauelshagen
Next version rejecting both monitoring flags being provided.
Quoted 22 lines · Heinz Mauelshagen
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_scanscript.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.
---
LVM2.2.02.53/tools/{vgchange.c.orig => vgchange.c} | 23 ++++++++++++++++---
1 files changed, 19 insertions(+), 4 deletions(-)tools/vgchange.c renamed from tools/vgchange.c.orig +19 -4
@@ -494,16 +494,31 @@ 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 )); +if (arg_count (cmd, ignoremonitoring_ARG) && +arg_count (cmd, monitor_ARG)) { +log_error ("Can't specify both monitoring flags" ); +return ECMD_FAILED ; + } + +/* 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_count (cmd, monitor_ARG)) + dmeventd_mode =arg_int_value (cmd, monitor_ARG, +DEFAULT_DMEVENTD_MONITOR ); +else + dmeventd_mode =DEFAULT_DMEVENTD_MONITOR ; + +init_dmeventd_monitor (dmeventd_mode);if (arg_count (cmd, available_ARG)) r =_vgchange_available (cmd, vg);