summaryrefslogtreecommitdiff
path: root/src/login/logind-user.c
diff options
context:
space:
mode:
authorDjalal Harouni <tixxdz@opendz.org>2014-02-13 18:31:43 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-13 21:07:13 +0100
commitb58b227a53ee2b9feba8433a1558b51132ffb18b (patch)
tree018caa5b7e72dcc1a04becfd203cc11598029c2d /src/login/logind-user.c
parent24fb111207566f3bb33c6438714fb5df44ed4305 (diff)
logind: make sure to terminate systemd user on logouts
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(). Since if user_check_gc() returns false this means that all the sessions of the user were removed which will make user_get_state() return USER_CLOSING. Conclusion: that test will never be statisfied. So we remove the USER_CLOSING check and replace it with a check inside user_stop() this way we know that user_stop() has already queued stop jobs, no need to redo. This ensures that the GC will get its two steps correctly as pointed out by Lennart: http://lists.freedesktop.org/archives/systemd-devel/2014-February/016825.html Note: this also fixes another bug that prevents creating the user private dbus socket which will break communications with the user manager.
Diffstat (limited to 'src/login/logind-user.c')
-rw-r--r--src/login/logind-user.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index ac4a651f3..4af0e90c2 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -499,6 +499,12 @@ int user_stop(User *u, bool force) {
int r = 0, k;
assert(u);
+ /* Stop jobs have already been queued */
+ if (u->stopping) {
+ user_save(u);
+ return r;
+ }
+
LIST_FOREACH(sessions_by_user, s, u->sessions) {
k = session_stop(s, force);
if (k < 0)