anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0116-unit-enqueue-cgroup-empty-check-event-if-the-last-re.patch

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