1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 11:55:55 +03:00

Ignore filter cache at startup if config file is newer than cache.

This commit is contained in:
Alasdair Kergon 2003-01-06 21:09:04 +00:00
parent d0df19e8a3
commit fdf481c665
4 changed files with 13 additions and 1 deletions

View File

@ -311,7 +311,9 @@ static int _init_filters(struct cmd_context *cmd)
if (!*cmd->sys_dir)
cmd->dump_filter = 0;
if (!stat(lvm_cache, &st) && !persistent_filter_load(f4))
if (!stat(lvm_cache, &st) &&
(st.st_mtime > config_file_timestamp(cmd->cf)) &&
!persistent_filter_load(f4))
log_verbose("Failed to load existing device cache from %s",
lvm_cache);

View File

@ -234,6 +234,13 @@ int read_config_file(struct config_tree *cf, const char *file)
return r;
}
time_t config_file_timestamp(struct config_tree *cf)
{
struct cs *c = (struct cs *) cf;
return c->timestamp;
}
/*
* Returns 1 if config file reloaded
*/

View File

@ -49,6 +49,7 @@ int read_config_fd(struct config_tree *cf, int fd, const char *file,
int read_config_file(struct config_tree *cf, const char *file);
int write_config_file(struct config_tree *cf, const char *file);
int reload_config_file(struct config_tree **cf);
time_t config_file_timestamp(struct config_tree *cf);
struct config_node *find_config_node(struct config_node *cn,
const char *path, const int separator);

View File

@ -109,6 +109,8 @@ int persistent_filter_load(struct dev_filter *f)
r = 1;
}
log_very_verbose("Loaded persistent filter cache from %s", pf->file);
out:
destroy_config_tree(cf);
return r;