richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
Blob Blame History Raw
From 1f4f34eb7592ec54f86040529c96d35efe97b219 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 11 Mar 2015 11:29:40 +0100
Subject: [PATCH] Revert "units: fix BindsTo= logic when applied relative to
 services with Type=oneshot"

This reverts commit 469d48cf685bd0157fa44ff7ebd3bd0302746ab0.

Resolves: #1203803
---
 src/core/unit.c | 48 ++++--------------------------------------------
 1 file changed, 4 insertions(+), 44 deletions(-)

diff --git a/src/core/unit.c b/src/core/unit.c
index f221b9a..b51e351 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1302,44 +1302,12 @@ static void unit_check_unneeded(Unit *u) {
                 if (unit_active_or_pending(other))
                         return;
 
-        log_info_unit(u->id, "Unit %s is not needed anymore. Stopping.", u->id);
+        log_info_unit(u->id, "Service %s is not needed anymore. Stopping.", u->id);
 
         /* Ok, nobody needs us anymore. Sniff. Then let's commit suicide */
         manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
 }
 
-static void unit_check_binds_to(Unit *u) {
-        bool stop = false;
-        Unit *other;
-        Iterator i;
-
-        assert(u);
-
-        if (u->job)
-                return;
-
-        if (unit_active_state(u) != UNIT_ACTIVE)
-                return;
-
-        SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i) {
-                if (other->job)
-                        continue;
-
-                if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other)))
-                        continue;
-
-                stop = true;
-        }
-
-        if (!stop)
-                return;
-
-        log_info_unit(u->id, "Unit %s is bound to inactive service. Stopping, too.", u->id);
-
-        /* A unit we need to run is gone. Sniff. Let's stop this. */
-        manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
-}
-
 static void retroactively_start_dependencies(Unit *u) {
         Iterator i;
         Unit *other;
@@ -1643,19 +1611,11 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
         manager_recheck_journal(m);
         unit_trigger_notify(u);
 
-        if (u->manager->n_reloading <= 0) {
-                /* Maybe we finished startup and are now ready for
-                 * being stopped because unneeded? */
+        /* Maybe we finished startup and are now ready for being
+         * stopped because unneeded? */
+        if (u->manager->n_reloading <= 0)
                 unit_check_unneeded(u);
 
-                /* Maybe we finished startup, but something we needed
-                 * has vanished? Let's die then. (This happens when
-                 * something BindsTo= to a Type=oneshot unit, as these
-                 * units go directly from starting to inactive,
-                 * without ever entering started.) */
-                unit_check_binds_to(u);
-        }
-
         unit_add_to_dbus_queue(u);
         unit_add_to_gc_queue(u);
 }