master - scripts: lvm2-activation-generator fix lvmconfig call
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6298eaeca50e32cdff3adefdb57b09c3250547a2 Commit: 6298eaeca50e32cdff3adefdb57b09c3250547a2 Parent: bc40391b7de93334c815565240848d5297f7a6c8 Author: Peter Rajnoha <[email protected]> AuthorDate: Fri Jan 4 11:11:13 2019 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Tue Jan 8 13:11:46 2019 +0100
scripts: lvm2-activation-generator fix lvmconfig call
Fix a scenario where global/event_activation setting is not found. In this case we need to take default value just like lvm tools do when executed. So use "lvmconfig --type full".
Also, if we fail to execute lvmconfig for whatever reason, fallback to generating the activation units as failsafe action.
Reported by: Bastian Blank <waldi debian org>
--- WHATS_NEW | 1 + scripts/generator-internals.c | 3 ++- .../lvm2_activation_generator_systemd_red_hat.c | 15 ++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.03.02 - =================================== + Fix generator quering lvmconfig unpresent config option. Fix memleak on bcache error path code. Fix missing unlock on lvm2 dmeventd plugin error path initialization. Improve Makefile dependency tracking.
scripts/generator-internals.c +2 -1
@@ -186,7 +186,8 @@ static bool _parse_line(const char *line, struct config *cfg)static bool _get_config (struct config *cfg,const char *lvmconfig_path) {static const char *_argv[] = { -"lvmconfig" ,LVM_CONF_EVENT_ACTIVATION ,LVM_CONF_USE_LVMPOLLD ,NULL +"lvmconfig" ,"--type" ,"full" , +LVM_CONF_EVENT_ACTIVATION ,LVM_CONF_USE_LVMPOLLD ,NULL };bool r = true;
scripts/lvm2_activation_generator_systemd_red_hat.c +10 -5
@@ -194,12 +194,17 @@ static bool _run(int argc, const char **argv)if (!_parse_command_line (&gen, argc, argv))return false; -if (!_get_config (&gen.cfg,LVMCONFIG_PATH )) -return false; +if (_get_config (&gen.cfg,LVMCONFIG_PATH )) { +if (gen.cfg.event_activation) +// If event_activation=1, pvscan --cache -aay does activation. +return true; + } -if (gen.cfg.event_activation) -// If event_activation=1, pvscan --cache -aay does activation. -return true; +/* +* Create the activation units if: +* - _get_config succeeded and event_activation=0 +* - _get_config failed, then this is a failsafe fallback +*/ /* mark lvm2-activation.*.service as world-accessible */ old_mask =umask (0022 );