richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
4bff0a
From 7b629b3a853c3b1e4e6a916a080996960343d7f2 Mon Sep 17 00:00:00 2001
4bff0a
From: Lennart Poettering <lennart@poettering.net>
4bff0a
Date: Fri, 5 Oct 2018 23:04:51 +0200
4bff0a
Subject: [PATCH] unit: enqueue cgroup empty check event if the last ref on a
4bff0a
 unit is dropped
4bff0a
4bff0a
(cherry picked from commit e5c36295d81971ef75d9c6f98f0890b92a4a353f)
4bff0a
4bff0a
Resolves: #1697893
4bff0a
---
4bff0a
 src/core/dbus-unit.c | 6 ++++++
4bff0a
 1 file changed, 6 insertions(+)
4bff0a
4bff0a
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
4bff0a
index ae0410414e..c5bca10979 100644
4bff0a
--- a/src/core/dbus-unit.c
4bff0a
+++ b/src/core/dbus-unit.c
4bff0a
@@ -1746,7 +1746,13 @@ static int bus_unit_track_handler(sd_bus_track *t, void *userdata) {
4bff0a
 
4bff0a
         u->bus_track = sd_bus_track_unref(u->bus_track); /* make sure we aren't called again */
4bff0a
 
4bff0a
+        /* If the client that tracks us disappeared, then there's reason to believe that the cgroup is empty now too,
4bff0a
+         * let's see */
4bff0a
+        unit_add_to_cgroup_empty_queue(u);
4bff0a
+
4bff0a
+        /* Also add the unit to the GC queue, after all if the client left it might be time to GC this unit */
4bff0a
         unit_add_to_gc_queue(u);
4bff0a
+
4bff0a
         return 0;
4bff0a
 }
4bff0a