chiark / gitweb /
logind: process session/inhibitor fds at higher priority
authorLennart Poettering <lennart@poettering.net>
Wed, 4 May 2016 17:01:56 +0000 (19:01 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:58 +0000 (10:12 +0200)
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.

src/login/logind-inhibit.c
src/login/logind-session.c
src/login/logind.c

index a0e3ba2b7cd20e3df8547ae3d11381244335377f..6c78e0dddc9f0d8e255a2e2b2d0614001750084a 100644 (file)
@@ -317,7 +317,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;
         }
index 2ed6b2fa355897c6faa85ced5ecc685c9af01513..61d34d1a9bcb69a0a8bda1718b79908b6becb797 100644 (file)
@@ -962,7 +962,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;
         }
index 83c6d8318cf44d6832d06c6d870b576f5cc8713a..e0cd70448eb4bb8ccd3043d2c429443f662857b8 100644 (file)
@@ -822,7 +822,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");