]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/manager.c
core: rename manager_unit_file_maybe_loadable_from_cache()
[thirdparty/systemd.git] / src / core / manager.c
index 49bf5419d8ee19d40b38e383414f137b1ff50a37..20ec7ba874ea7bd937c7523e5092efca27b15268 100644 (file)
@@ -1947,18 +1947,24 @@ unsigned manager_dispatch_load_queue(Manager *m) {
         return n;
 }
 
-bool manager_unit_file_maybe_loadable_from_cache(Unit *u) {
+bool manager_unit_cache_should_retry_load(Unit *u) {
         assert(u);
 
+        /* Automatic reloading from disk only applies to units which were not found sometime in the past, and
+         * the not-found stub is kept pinned in the unit graph by dependencies. For units that were
+         * previously loaded, we don't do automatic reloading, and daemon-reload is necessary to update. */
         if (u->load_state != UNIT_NOT_FOUND)
                 return false;
 
         if (u->manager->unit_cache_mtime == 0)
                 return false;
 
+        /* The cache has been updated since the last time we tried to load the unit. There might be new
+         * fragment paths to read. */
         if (u->manager->unit_cache_mtime > u->fragment_loadtime)
                 return true;
 
+        /* The cache needs to be updated because there are modifications on disk. */
         return !lookup_paths_mtime_good(&u->manager->lookup_paths, u->manager->unit_cache_mtime);
 }
 
@@ -2008,10 +2014,10 @@ int manager_load_unit_prepare(
                  * first if anything in the usual paths was modified since the last time
                  * the cache was loaded. Also check if the last time an attempt to load the
                  * unit was made was before the most recent cache refresh, so that we know
-                 * we need to try again - even if the cache is current, it might have been
+                 * we need to try again  even if the cache is current, it might have been
                  * updated in a different context before we had a chance to retry loading
                  * this particular unit. */
-                if (manager_unit_file_maybe_loadable_from_cache(ret))
+                if (manager_unit_cache_should_retry_load(ret))
                         ret->load_state = UNIT_STUB;
                 else {
                         *_ret = ret;