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