1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tools: update for lvm2_disable_dmeventd_monitoring

Make lvm2_disable_dmeventd_monitoring() more explicit.

As memlock_inc_daemon() is also used by clvmd, which
does changes dmeventd and suspend ignore state at
some stages - make updates of these 2 variable
tied to the call of  lvm2_disable_dmeventd_monitoring().

Once this call is made dmeventd monitoring
and suspended devices are ignored.

TODO: all lvm-global settings should really be moved
to command context.
This commit is contained in:
Zdenek Kabelac 2015-10-23 10:48:01 +02:00
parent 87a39d8bac
commit e5b686d693
3 changed files with 12 additions and 4 deletions

View File

@ -40,6 +40,8 @@ static int _security_level = SECURITY_LEVEL;
static char _cmd_name[30] = ""; static char _cmd_name[30] = "";
static int _mirror_in_sync = 0; static int _mirror_in_sync = 0;
static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR; static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR;
/* When set, disables update of _dmeventd_monitor & _ignore_suspended_devices */
static int _disable_dmeventd_monitoring = 0;
static int _background_polling = DEFAULT_BACKGROUND_POLLING; static int _background_polling = DEFAULT_BACKGROUND_POLLING;
static int _ignore_suspended_devices = 0; static int _ignore_suspended_devices = 0;
static int _ignore_lvm_mirrors = DEFAULT_IGNORE_LVM_MIRRORS; static int _ignore_lvm_mirrors = DEFAULT_IGNORE_LVM_MIRRORS;
@ -123,10 +125,15 @@ void init_mirror_in_sync(int in_sync)
void init_dmeventd_monitor(int reg) void init_dmeventd_monitor(int reg)
{ {
if (!memlock_count_daemon()) if (!_disable_dmeventd_monitoring)
_dmeventd_monitor = reg; _dmeventd_monitor = reg;
} }
void init_disable_dmeventd_monitoring(int reg)
{
_disable_dmeventd_monitoring = reg;
}
void init_background_polling(int polling) void init_background_polling(int polling)
{ {
_background_polling = polling; _background_polling = polling;
@ -134,7 +141,7 @@ void init_background_polling(int polling)
void init_ignore_suspended_devices(int ignore) void init_ignore_suspended_devices(int ignore)
{ {
if (!memlock_count_daemon()) if (!_disable_dmeventd_monitoring)
_ignore_suspended_devices = ignore; _ignore_suspended_devices = ignore;
} }

View File

@ -38,6 +38,7 @@ void init_lockingfailed(int level);
void init_security_level(int level); void init_security_level(int level);
void init_mirror_in_sync(int in_sync); void init_mirror_in_sync(int in_sync);
void init_dmeventd_monitor(int reg); void init_dmeventd_monitor(int reg);
void init_disable_dmeventd_monitoring(int disable);
void init_background_polling(int polling); void init_background_polling(int polling);
void init_ignore_suspended_devices(int ignore); void init_ignore_suspended_devices(int ignore);
void init_ignore_lvm_mirrors(int scan); void init_ignore_lvm_mirrors(int scan);

View File

@ -80,8 +80,6 @@ int lvm2_run(void *handle, const char *cmdline)
/* FIXME Temporary - move to libdevmapper */ /* FIXME Temporary - move to libdevmapper */
ret = ECMD_PROCESSED; 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); memlock_inc_daemon(cmd);
} else if (!strcmp(cmdline, "_memlock_dec")) } else if (!strcmp(cmdline, "_memlock_dec"))
memlock_dec_daemon(cmd); memlock_dec_daemon(cmd);
@ -99,6 +97,8 @@ int lvm2_run(void *handle, const char *cmdline)
void lvm2_disable_dmeventd_monitoring(void *handle) { void lvm2_disable_dmeventd_monitoring(void *handle) {
init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE); init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE);
init_ignore_suspended_devices(1);
init_disable_dmeventd_monitoring(1); /* Lock settings */
} }
void lvm2_log_level(void *handle, int level) void lvm2_log_level(void *handle, int level)