]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
move MANAGER_IS_RELOADING() check into manager_recheck_{dbus|journal}() (#8510)
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Mar 2018 11:03:45 +0000 (12:03 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 21 Mar 2018 11:03:45 +0000 (12:03 +0100)
Let's better check this inside of the call than before it, so that we
never issue this while reloading, even should these calls be called due
to other reasons than just the unit notify.

This makes sure the reload state is unset a bit earlier in
manager_reload() so that we can safely call this function from there and
they do the right thing.

Follow-up for e63ebf71edd7947f29389c72e851d8df5c7bedda.

src/core/manager.c
src/core/unit.c

index 33a708adf8170ed3eafa2e548b990e6bc20e593c..7026a58d7348159a3e5c33d42b40a3ab21063449 100644 (file)
@@ -3221,6 +3221,9 @@ int manager_reload(Manager *m) {
 
         exec_runtime_vacuum(m);
 
+        assert(m->n_reloading > 0);
+        m->n_reloading--;
+
         /* It might be safe to log to the journal now and connect to dbus */
         manager_recheck_journal(m);
         manager_recheck_dbus(m);
@@ -3230,9 +3233,6 @@ int manager_reload(Manager *m) {
         if (q < 0 && r >= 0)
                 r = q;
 
-        assert(m->n_reloading > 0);
-        m->n_reloading--;
-
         m->send_reloading_done = true;
 
         return r;
@@ -3596,6 +3596,9 @@ void manager_recheck_dbus(Manager *m) {
          * connection of the API bus). That's because the system bus after all runs as service of the system instance,
          * while in the user instance we can assume it's already there. */
 
+        if (MANAGER_IS_RELOADING(m))
+                return; /* don't check while we are reloading… */
+
         if (manager_dbus_is_running(m, false)) {
                 (void) bus_init_api(m);
 
@@ -3646,6 +3649,10 @@ void manager_recheck_journal(Manager *m) {
         if (getpid_cached() != 1)
                 return;
 
+        /* Don't check this while we are reloading, things might still change */
+        if (MANAGER_IS_RELOADING(m))
+                return;
+
         /* The journal is fully and entirely up? If so, let's permit logging to it, if that's configured. If the
          * journal is down, don't ever log to it, otherwise we might end up deadlocking ourselves as we might trigger
          * an activation ourselves we can't fulfill. */
index cb45dc290a66870a9592368e687375b0d539ef4e..52851b6ffc4adbdc5cf8583b6b1f9dc971c79757 100644 (file)
@@ -2501,10 +2501,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
                 }
         }
 
-        if (!MANAGER_IS_RELOADING(u->manager)) {
-                manager_recheck_journal(m);
-                manager_recheck_dbus(m);
-        }
+        manager_recheck_journal(m);
+        manager_recheck_dbus(m);
 
         unit_trigger_notify(u);