You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.5 KiB

From caca204d23babbdb0c688f543f3ee8d66a1a2001 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 4 May 2016 19:01:56 +0200
Subject: [PATCH] logind: process session/inhibitor fds at higher priority
Let's make sure we process session and inhibitor pipe fds (that signal
sessions/inhibtors going away) at a higher priority
than new bus calls that might create new sessions or inhibitors. This helps
ensuring that the number of open sessions stays minimal.
Cherry-picked from: e11544a8305ab9dea097c74bb16e296150c9cc10
Resolves: #1305608
---
src/login/logind-inhibit.c | 2 +-
src/login/logind-session.c | 4 +++-
src/login/logind.c | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index 84fee0e77..bf96898f2 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -303,7 +303,7 @@ int inhibitor_create_fifo(Inhibitor *i) {
if (r < 0)
return r;
- r = sd_event_source_set_priority(i->event_source, SD_EVENT_PRIORITY_IDLE);
+ r = sd_event_source_set_priority(i->event_source, SD_EVENT_PRIORITY_IDLE-10);
if (r < 0)
return r;
}
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index dc24539f1..59f5a7ad5 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -905,7 +905,9 @@ int session_create_fifo(Session *s) {
if (r < 0)
return r;
- r = sd_event_source_set_priority(s->fifo_event_source, SD_EVENT_PRIORITY_IDLE);
+ /* Let's make sure we noticed dead sessions before we process new bus requests (which might create new
+ * sessions). */
+ r = sd_event_source_set_priority(s->fifo_event_source, SD_EVENT_PRIORITY_NORMAL-10);
if (r < 0)
return r;
}
diff --git a/src/login/logind.c b/src/login/logind.c
index 3afbf34a1..e8d0669bb 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -685,7 +685,7 @@ static int manager_connect_bus(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to register name: %m");
- r = sd_bus_attach_event(m->bus, m->event, 0);
+ r = sd_bus_attach_event(m->bus, m->event, SD_EVENT_PRIORITY_NORMAL);
if (r < 0)
return log_error_errno(r, "Failed to attach bus to event loop: %m");