mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-28 02:50:41 +03:00
dev-cache: ignore persistent cache if configuration changed
Commit f6473baffc2d0b486b2aa941cf2681683026b3a5 introduced a new cmd->initialized variable to keep info about which parts of the cmd_context have been initialized. A part of this patch was also a change in refresh_filters fn which checks for cmd->initialized.filters variable and it does the filter refresh *only* if the filter has already been initialized before otherwise it's a NOOP (before, the refresh_filters also initialized filters as a side effect in case it had not been initialized before which was not quite correct). However, the commit f6473baffc2d0b486b2aa941cf2681683026b3a5 did not handle the case in which configuration changes either via --config argument or when configuration file changed and its timestamp was higher than the timestamp of the persistent cache file - the /etc/lvm/cache/.cache. This patch fixes this issue and it causes the init_filters fn in lvm_run_command fn to be called with proper value of "load_persistent_cache" switch even if the configuration changes, hence causing the persistent cache file to be ignored in this case.
This commit is contained in:
parent
d323acdfec
commit
2296999cf6
@ -1,5 +1,6 @@
|
||||
Version 2.02.131 -
|
||||
=====================================
|
||||
Ignore persistent cache if configuration changed. (2.02.127)
|
||||
Fix devices/filter to be applied before disk-accessing filters. (2.02.112)
|
||||
Make tags only when requested via 'make tags'.
|
||||
Configure supports --disable-dependency-tracking for one-time builds.
|
||||
|
@ -1478,6 +1478,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
char *arg_new, *arg;
|
||||
int i;
|
||||
int skip_hyphens;
|
||||
int refresh_done = 0;
|
||||
|
||||
init_error_message_produced(0);
|
||||
|
||||
@ -1554,6 +1555,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
log_error("Updated config file invalid. Aborting.");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
refresh_done = 1;
|
||||
}
|
||||
|
||||
if (!_prepare_profiles(cmd))
|
||||
@ -1562,7 +1564,11 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (!cmd->initialized.connections && !_cmd_no_meta_proc(cmd) && !init_connections(cmd))
|
||||
return_ECMD_FAILED;
|
||||
|
||||
if (!cmd->initialized.filters && !_cmd_no_meta_proc(cmd) && !init_filters(cmd, 1))
|
||||
/* Note: Load persistent cache only if we haven't refreshed toolcontext!
|
||||
* If toolcontext has been refreshed, it means config has changed
|
||||
* and we can't rely on persistent cache anymore.
|
||||
*/
|
||||
if (!cmd->initialized.filters && !_cmd_no_meta_proc(cmd) && !init_filters(cmd, !refresh_done))
|
||||
return_ECMD_FAILED;
|
||||
|
||||
if (arg_count(cmd, readonly_ARG))
|
||||
|
Loading…
x
Reference in New Issue
Block a user