From 9a4b04139d184d3dc3f14766d606bf6c535eca5a Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Wed, 30 Nov 2011 17:00:57 +0000 Subject: [PATCH] Fix clvmd to respect DMEVENTD_MONITOR_IGNORE. Fixes a bug where dmeventd actions caused clvmd to turn off monitoring of the volume causing the action. --- daemons/clvmd/lvm-functions.c | 17 +++++++++++------ lib/locking/cluster_locking.c | 5 ++++- lib/locking/locking.h | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index aa3067091..b92b618bb 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -132,13 +132,14 @@ static const char *decode_flags(unsigned char flags) 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_DMEVENTD_MONITOR_IGNORE ? "DMEVENTD_MONITOR_IGNORE|" : ""); if (len > 1) buf[len - 2] = ' '; @@ -512,10 +513,14 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource) 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_DMEVENTD_MONITOR_IGNORE) + init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE); + else { + if (lock_flags & LCK_DMEVENTD_MONITOR_MODE) + init_dmeventd_monitor(1); + else + init_dmeventd_monitor(0); + } cmd->partial_activation = (lock_flags & LCK_PARTIAL_MODE) ? 1 : 0; diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c index 58e80af14..bf87d1402 100644 --- a/lib/locking/cluster_locking.c +++ b/lib/locking/cluster_locking.c @@ -341,7 +341,10 @@ static int _lock_for_cluster(struct cmd_context *cmd, unsigned char clvmd_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_DMEVENTD_MONITOR_IGNORE; + + if (dmeventd_mode) args[1] |= LCK_DMEVENTD_MONITOR_MODE; if (cmd->partial_activation) diff --git a/lib/locking/locking.h b/lib/locking/locking.h index 1924440e5..951621d93 100644 --- a/lib/locking/locking.h +++ b/lib/locking/locking.h @@ -109,6 +109,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname); #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_DMEVENTD_MONITOR_IGNORE 0x80 /* Whether to ignore dmeventd */ /* * Special cases of VG locks. -- 2.43.5