From f04df1c6cb4841d5362aeea0f0da4be17741829c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 12 Mar 2013 16:00:13 +0100 Subject: [PATCH] Clean up closing empty sessions when not running under systemd In logind's manager_gc(), submit "closing" session to garbage collection, to clean them up once they are empty. This is usually triggered through manager_cgroup_notify_empty() from a org.freedesktop.systemd1.Agent.Released signal, but that doesn't happen when not running under systemd. TODO: Only do this when not running under systemd, to avoid unnecessary overhead. --- src/login/logind.c | 6 ++++++ 1 file changed, 6 insertions(+) Index: systemd/src/login/logind.c =================================================================== --- systemd.orig/src/login/logind.c 2013-04-29 14:43:24.720833973 -0700 +++ systemd/src/login/logind.c 2013-04-29 14:43:24.716833973 -0700 @@ -1361,9 +1361,15 @@ Seat *seat; Session *session; User *user; + Iterator i; assert(m); + /* clean up empty sessions when not running under systemd */ + HASHMAP_FOREACH(session, m->session_cgroups, i) + if (session_get_state(session) == SESSION_CLOSING) + session_add_to_gc_queue(session); + while ((seat = m->seat_gc_queue)) { LIST_REMOVE(Seat, gc_queue, m->seat_gc_queue, seat); seat->in_gc_queue = false;