]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: coldplug all units which participate in jobs during coldplugging
authorIvan Shapovalov <intelfx100@gmail.com>
Mon, 27 Apr 2015 18:19:02 +0000 (21:19 +0300)
committerLennart Poettering <lennart@poettering.net>
Mon, 27 Apr 2015 19:45:12 +0000 (21:45 +0200)
This is yet another attempt to fix coldplugging order (more especially,
the problem which happens when one creates a job during coldplugging and
it references a not-yet-coldplugged unit).

Now we forcibly coldplug all units which participate in jobs. This
is a superset of previously implemented handling of the UNIT_TRIGGERS
dependencies, so that handling is removed.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031212.html
https://bugs.freedesktop.org/show_bug.cgi?id=88401 (once again)

src/core/transaction.c
src/core/unit.c

index 5974b1e96b24b4fe30c18c9162a9f56c2b28ec02..7b19e2f8415df6b43f78824e1785dbc867bc44a5 100644 (file)
@@ -848,6 +848,13 @@ int transaction_add_job_and_dependencies(
         assert(type < _JOB_TYPE_MAX_IN_TRANSACTION);
         assert(unit);
 
+        /* Before adding jobs for this unit, let's ensure that its state has been loaded
+         * This matters when jobs are spawned as part of coldplugging itself (see e. g. path_coldplug()).
+         * This way, we "recursively" coldplug units, ensuring that we do not look at state of
+         * not-yet-coldplugged units. */
+        if (unit->manager->n_reloading > 0)
+                unit_coldplug(unit);
+
         /* log_debug("Pulling in %s/%s from %s/%s", */
         /*           unit->id, job_type_to_string(type), */
         /*           by ? by->unit->id : "NA", */
index 496db6c4cda14687318f54a7eaf861c5062added..b7ab084de90cbaea6575b2844e03a9d9e392944a 100644 (file)
@@ -2893,14 +2893,6 @@ int unit_coldplug(Unit *u) {
 
         u->coldplugged = true;
 
-        /* Make sure everything that we might pull in through
-         * triggering is coldplugged before us */
-        SET_FOREACH(other, u->dependencies[UNIT_TRIGGERS], i) {
-                r = unit_coldplug(other);
-                if (r < 0)
-                        return r;
-        }
-
         if (UNIT_VTABLE(u)->coldplug) {
                 r = UNIT_VTABLE(u)->coldplug(u);
                 if (r < 0)