summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/login/logind-user.c6
-rw-r--r--src/login/logind.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index ac4a651f36..4af0e90c22 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)
diff --git a/src/login/logind.c b/src/login/logind.c
index 554409926a..2add241066 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -889,10 +889,11 @@ 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)
+ /* First step: queue stop jobs */
+ if (!user_check_gc(user, drop_not_started))
user_stop(user, false);
+ /* Second step: finalize user */
if (!user_check_gc(user, drop_not_started)) {
user_finalize(user);
user_free(user);