923a60
From 95216d7246fe5e8ac404cc9d432072eb59f2af04 Mon Sep 17 00:00:00 2001
923a60
From: Colin Walters <walters@verbum.org>
923a60
Date: Tue, 17 Feb 2015 13:47:34 -0500
923a60
Subject: [PATCH] unit: When stopping due to BindsTo=, log which unit caused it
923a60
923a60
I'm trying to track down a relatively recent change in systemd
923a60
which broke OSTree; see https://bugzilla.gnome.org/show_bug.cgi?id=743891
923a60
923a60
Systemd started to stop sysroot.mount, and this patch should help
923a60
me debug why at least.
923a60
923a60
While we're here, "break" on the first unit we find that will
923a60
deactivate, as there's no point in further iteration.
923a60
923a60
(cherry picked from commit 98f738b62047229af4a929d7996e2ab04253b02c)
923a60
---
923a60
 src/core/unit.c | 4 +++-
923a60
 1 file changed, 3 insertions(+), 1 deletion(-)
923a60
923a60
diff --git a/src/core/unit.c b/src/core/unit.c
923a60
index 9f1e55e2f1..563f6fe850 100644
923a60
--- a/src/core/unit.c
923a60
+++ b/src/core/unit.c
923a60
@@ -1648,12 +1648,14 @@ static void unit_check_binds_to(Unit *u) {
923a60
                         continue;
923a60
 
923a60
                 stop = true;
923a60
+                break;
923a60
         }
923a60
 
923a60
         if (!stop)
923a60
                 return;
923a60
 
923a60
-        log_unit_info(u->id, "Unit %s is bound to inactive unit. Stopping, too.", u->id);
923a60
+        assert(other);
923a60
+        log_unit_info(u->id, "Unit %s is bound to inactive unit %s. Stopping, too.", u->id, other->id);
923a60
 
923a60
         /* A unit we need to run is gone. Sniff. Let's stop this. */
923a60
         manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);