teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0385-Revert-units-fix-BindsTo-logic-when-applied-relative.patch

a1d4eb
From 1f4f34eb7592ec54f86040529c96d35efe97b219 Mon Sep 17 00:00:00 2001
a1d4eb
From: Michal Sekletar <msekleta@redhat.com>
a1d4eb
Date: Wed, 11 Mar 2015 11:29:40 +0100
a1d4eb
Subject: [PATCH] Revert "units: fix BindsTo= logic when applied relative to
a1d4eb
 services with Type=oneshot"
a1d4eb
a1d4eb
This reverts commit 469d48cf685bd0157fa44ff7ebd3bd0302746ab0.
a1d4eb
a1d4eb
Resolves: #1203803
a1d4eb
---
a1d4eb
 src/core/unit.c | 48 ++++--------------------------------------------
a1d4eb
 1 file changed, 4 insertions(+), 44 deletions(-)
a1d4eb
a1d4eb
diff --git a/src/core/unit.c b/src/core/unit.c
a1d4eb
index f221b9a..b51e351 100644
a1d4eb
--- a/src/core/unit.c
a1d4eb
+++ b/src/core/unit.c
a1d4eb
@@ -1302,44 +1302,12 @@ static void unit_check_unneeded(Unit *u) {
a1d4eb
                 if (unit_active_or_pending(other))
a1d4eb
                         return;
a1d4eb
 
a1d4eb
-        log_info_unit(u->id, "Unit %s is not needed anymore. Stopping.", u->id);
a1d4eb
+        log_info_unit(u->id, "Service %s is not needed anymore. Stopping.", u->id);
a1d4eb
 
a1d4eb
         /* Ok, nobody needs us anymore. Sniff. Then let's commit suicide */
a1d4eb
         manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
a1d4eb
 }
a1d4eb
 
a1d4eb
-static void unit_check_binds_to(Unit *u) {
a1d4eb
-        bool stop = false;
a1d4eb
-        Unit *other;
a1d4eb
-        Iterator i;
a1d4eb
-
a1d4eb
-        assert(u);
a1d4eb
-
a1d4eb
-        if (u->job)
a1d4eb
-                return;
a1d4eb
-
a1d4eb
-        if (unit_active_state(u) != UNIT_ACTIVE)
a1d4eb
-                return;
a1d4eb
-
a1d4eb
-        SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i) {
a1d4eb
-                if (other->job)
a1d4eb
-                        continue;
a1d4eb
-
a1d4eb
-                if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other)))
a1d4eb
-                        continue;
a1d4eb
-
a1d4eb
-                stop = true;
a1d4eb
-        }
a1d4eb
-
a1d4eb
-        if (!stop)
a1d4eb
-                return;
a1d4eb
-
a1d4eb
-        log_info_unit(u->id, "Unit %s is bound to inactive service. Stopping, too.", u->id);
a1d4eb
-
a1d4eb
-        /* A unit we need to run is gone. Sniff. Let's stop this. */
a1d4eb
-        manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
a1d4eb
-}
a1d4eb
-
a1d4eb
 static void retroactively_start_dependencies(Unit *u) {
a1d4eb
         Iterator i;
a1d4eb
         Unit *other;
a1d4eb
@@ -1643,19 +1611,11 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
a1d4eb
         manager_recheck_journal(m);
a1d4eb
         unit_trigger_notify(u);
a1d4eb
 
a1d4eb
-        if (u->manager->n_reloading <= 0) {
a1d4eb
-                /* Maybe we finished startup and are now ready for
a1d4eb
-                 * being stopped because unneeded? */
a1d4eb
+        /* Maybe we finished startup and are now ready for being
a1d4eb
+         * stopped because unneeded? */
a1d4eb
+        if (u->manager->n_reloading <= 0)
a1d4eb
                 unit_check_unneeded(u);
a1d4eb
 
a1d4eb
-                /* Maybe we finished startup, but something we needed
a1d4eb
-                 * has vanished? Let's die then. (This happens when
a1d4eb
-                 * something BindsTo= to a Type=oneshot unit, as these
a1d4eb
-                 * units go directly from starting to inactive,
a1d4eb
-                 * without ever entering started.) */
a1d4eb
-                unit_check_binds_to(u);
a1d4eb
-        }
a1d4eb
-
a1d4eb
         unit_add_to_dbus_queue(u);
a1d4eb
         unit_add_to_gc_queue(u);
a1d4eb
 }