[systemd-devel] [PATCH] logind: just call user_stop() if user_check_gc() returns false

Djalal Harouni tixxdz at opendz.org
Sat Feb 8 10:20:42 PST 2014


Currently if the user logs out, the GC may never call user_stop(),
this will not terminate the systemd user and (sd-pam) of that user.

To fix this, remove the USER_CLOSING state check that is blocking the
GC from calling user_stop(). We do not need it since with the current
logic we have:

1) if user_check_gc() returns false this means that all the sessions of
the user were removed.

2) if all the sessions were removed and if linger is not set and if it
is not open state then user_get_state() will return always USER_CLOSING.

So that check will never be satisfied for normal cases, and for linger
user_check_gc() will return true which prevents the GC from collecting
the user.
---
 src/login/logind.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/login/logind.c b/src/login/logind.c
index a6f84e8..84c5b7d 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -889,11 +889,8 @@ void manager_gc(Manager *m, bool drop_not_started) {
                 LIST_REMOVE(gc_queue, m->user_gc_queue, user);
                 user->in_gc_queue = false;
 
-                if (!user_check_gc(user, drop_not_started) &&
-                    user_get_state(user) != USER_CLOSING)
-                        user_stop(user);
-
                 if (!user_check_gc(user, drop_not_started)) {
+                        user_stop(user);
                         user_finalize(user);
                         user_free(user);
                 }
-- 
1.8.3.1



More information about the systemd-devel mailing list