[systemd-devel] [PATCH 1/2] logind: make the manager able to collect closed sessions

Djalal Harouni tixxdz at opendz.org
Fri Jan 3 05:19:20 PST 2014


Currently on logout, session and user state files might stay and will
not be cleaned up, this is true on systems where dbus TerminateSession()
is not called on logouts.

The manager garbage-collector will miss them due to the session_gc_queue
being empty. A call to dbus TerminateSession() which will call
session_stop() is needed in order to push the session into the
session_gc_queue.

To ensure that sessions will have the chance to be collected, make the
method_release_session() call session_add_to_gc_queue() before
finishing, this gives the manager_gc() a chance to check if the current
session should be collected and if so call session_stop() on it.
---
 src/login/logind-dbus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 08510b5..c18a74a 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -742,6 +742,7 @@ static int method_release_session(sd_bus *bus, sd_bus_message *message, void *us
         session_remove_fifo(session);
         session_save(session);
         user_save(session->user);
+        session_add_to_gc_queue(session);
 
         return sd_bus_reply_method_return(message, NULL);
 }
-- 
1.8.3.1



More information about the systemd-devel mailing list