anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0330-logind-process-session-inhibitor-fds-at-higher-prior.patch

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