chiark / gitweb /
core: set some event source priorities to enforce dispatching order
authorLennart Poettering <lennart@poettering.net>
Mon, 25 Nov 2013 14:35:10 +0000 (15:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 25 Nov 2013 16:40:53 +0000 (17:40 +0100)
src/core/manager.c
src/core/mount.c
src/core/swap.c

index c424fece52f385170264f3eae032c58fc1d3de17..ba4dab3b86c919e8f79691c543beb3036a082c59 100644 (file)
@@ -368,6 +368,11 @@ static int manager_setup_signals(Manager *m) {
         if (r < 0)
                 return r;
 
+        /* Process signals a bit earlier than the rest of things */
+        r = sd_event_source_set_priority(m->signal_event_source, -5);
+        if (r < 0)
+                return r;
+
         if (m->running_as == SYSTEMD_SYSTEM)
                 return enable_special_signals(m);
 
index bf1d43396692db35d968e513bb49c684ca14afaf..634dff19a978a28ccf554eaae940ec4517ad4b54 100644 (file)
@@ -1611,6 +1611,13 @@ static int mount_enumerate(Manager *m) {
                 r = sd_event_add_io(m->event, fileno(m->proc_self_mountinfo), EPOLLPRI, mount_dispatch_io, m, &m->mount_event_source);
                 if (r < 0)
                         goto fail;
+
+                /* Dispatch this before we dispatch SIGCHLD, so that
+                 * we always get the events from /proc/self/mountinfo
+                 * before the SIGCHLD of /bin/mount. */
+                r = sd_event_source_set_priority(m->mount_event_source, -10);
+                if (r < 0)
+                        goto fail;
         }
 
         r = mount_load_proc_self_mountinfo(m, false);
index fff613934ae009954331f722292621cb68cb2a32..adcf78b7175985d3187ea9658105056b847d0fe2 100644 (file)
@@ -1238,6 +1238,13 @@ static int swap_enumerate(Manager *m) {
                 r = sd_event_add_io(m->event, fileno(m->proc_swaps), EPOLLPRI, swap_dispatch_io, m, &m->swap_event_source);
                 if (r < 0)
                         goto fail;
+
+                /* Dispatch this before we dispatch SIGCHLD, so that
+                 * we always get the events from /proc/swaps before
+                 * the SIGCHLD of /sbin/swapon. */
+                r = sd_event_source_set_priority(m->swap_event_source, -10);
+                if (r < 0)
+                        goto fail;
         }
 
         r = swap_load_proc_swaps(m, false);