core: reload cache if it's dirty when starting a UNIT_NOT_FOUND unit

The time-based cache allows starting a new unit without an expensive
daemon-reload, unless there was already a reference to it because of
a dependency or ordering from another unit.
If the cache is out of date, check again if we can load the
fragment.
This commit is contained in:
Luca Boccassi
2020-05-30 16:50:05 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 956508cb5d
commit d904afc730
7 changed files with 81 additions and 10 deletions
+1 -1
View File
@@ -199,7 +199,7 @@ static bool lookup_paths_mtime_exclude(const LookupPaths *lp, const char *path)
streq_ptr(path, lp->runtime_control);
}
static bool lookup_paths_mtime_good(const LookupPaths *lp, usec_t mtime) {
bool lookup_paths_mtime_good(const LookupPaths *lp, usec_t mtime) {
char **dir;
STRV_FOREACH(dir, (char**) lp->search_path) {
+1
View File
@@ -43,6 +43,7 @@ bool unit_type_may_template(UnitType type) _const_;
int unit_symlink_name_compatible(const char *symlink, const char *target, bool instance_propagation);
int unit_validate_alias_symlink_and_warn(const char *filename, const char *target);
bool lookup_paths_mtime_good(const LookupPaths *lp, usec_t mtime);
int unit_file_build_name_map(
const LookupPaths *lp,
usec_t *ret_time,