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