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