From d2c4ce254bac0f607676b10e38ba2f2ebee709b8 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 22 Oct 2015 10:44:38 +0200 Subject: [PATCH] tools: preselect some setting for memlocked daemons When our daemon is locked into memory - avoid communication with dmeventd and also skip suspended devices. --- lib/misc/lvm-globals.c | 6 ++++-- tools/lvmcmdlib.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c index 60397e55e..0cdcc885b 100644 --- a/lib/misc/lvm-globals.c +++ b/lib/misc/lvm-globals.c @@ -123,7 +123,8 @@ void init_mirror_in_sync(int in_sync) void init_dmeventd_monitor(int reg) { - _dmeventd_monitor = reg; + if (!memlock_count_daemon()) + _dmeventd_monitor = reg; } void init_background_polling(int polling) @@ -133,7 +134,8 @@ void init_background_polling(int polling) void init_ignore_suspended_devices(int ignore) { - _ignore_suspended_devices = ignore; + if (!memlock_count_daemon()) + _ignore_suspended_devices = ignore; } void init_ignore_lvm_mirrors(int scan) diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c index 26f160f88..ae8ff5c7e 100644 --- a/tools/lvmcmdlib.c +++ b/tools/lvmcmdlib.c @@ -79,9 +79,11 @@ int lvm2_run(void *handle, const char *cmdline) /* FIXME Temporary - move to libdevmapper */ ret = ECMD_PROCESSED; - if (!strcmp(cmdline, "_memlock_inc")) + if (!strcmp(cmdline, "_memlock_inc")) { + init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE); + init_ignore_suspended_devices(1); memlock_inc_daemon(cmd); - else if (!strcmp(cmdline, "_memlock_dec")) + } else if (!strcmp(cmdline, "_memlock_dec")) memlock_dec_daemon(cmd); else ret = lvm_run_command(cmd, argc, argv); -- 2.43.5