diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index 9d62675cf..5f1658dfd 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -508,7 +508,7 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource) DEBUGLOG("do_lock_lv: resource '%s', cmd = %s, flags = %s, critical_section = %d\n", resource, decode_locking_cmd(command), decode_flags(lock_flags), critical_section()); - if (!cmd->config_valid || config_files_changed(cmd)) { + if (!cmd->config_initialized || config_files_changed(cmd)) { /* Reinitialise various settings inc. logging, filters */ if (do_refresh_cache()) { log_error("Updated config file invalid. Aborting."); diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 5f99b0b0c..b7e3d46ef 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -1507,9 +1507,9 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived, cmd->default_settings.cache_vgmetadata = 1; cmd->current_settings = cmd->default_settings; - cmd->config_valid = 1; + cmd->config_initialized = 1; out: - if (cmd->config_valid != 1) { + if (!cmd->config_initialized) { destroy_toolcontext(cmd); cmd = NULL; } @@ -1624,7 +1624,7 @@ int refresh_toolcontext(struct cmd_context *cmd) cft_cmdline = remove_config_tree_by_source(cmd, CONFIG_STRING); _destroy_config(cmd); - cmd->config_valid = 0; + cmd->config_initialized = 0; cmd->hosttags = 0; @@ -1681,7 +1681,7 @@ int refresh_toolcontext(struct cmd_context *cmd) if (!_init_backup(cmd)) return 0; - cmd->config_valid = 1; + cmd->config_initialized = 1; reset_lvm_errno(1); return 1; diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index 7551245cb..42a4e54f2 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -98,14 +98,16 @@ struct cmd_context { struct dev_filter *lvmetad_filter; int dump_filter; /* Dump filter when exiting? */ - struct dm_list config_files; - int config_valid; - struct dm_config_tree *cft; - struct config_info default_settings; - struct config_info current_settings; - struct dm_hash_table *cft_def_hash; /* cft definition hash used for validity check */ + struct dm_list config_files; /* master lvm config + any existing tag configs */ + struct profile_params *profile_params; /* profile handling params including loaded profile configs */ + struct dm_config_tree *cft; /* the whole cascade: CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES */ + int config_initialized; /* used to reinitialize config if previous init was not successful */ + struct dm_hash_table *cft_def_hash; /* config definition hash used for validity check (item type + item recognized) */ - struct profile_params *profile_params; + /* selected settings with original default/configured value which can be changed during cmd processing */ + struct config_info default_settings; + /* may contain changed values compared to default_settings */ + struct config_info current_settings; struct archive_params *archive_params; struct backup_params *backup_params; diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 6efa29a1f..3aa4206b0 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1080,7 +1080,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv) goto_out; } - if (arg_count(cmd, config_ARG) || !cmd->config_valid || config_files_changed(cmd)) { + if (arg_count(cmd, config_ARG) || !cmd->config_initialized || config_files_changed(cmd)) { /* Reinitialise various settings inc. logging, filters */ if (!refresh_toolcontext(cmd)) { old_cft = remove_config_tree_by_source(cmd, CONFIG_STRING);