From 290837072b136624f1f3d941c7274e4b1b275021 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 25 Nov 2013 15:35:10 +0100 Subject: [PATCH] core: set some event source priorities to enforce dispatching order --- src/core/manager.c | 5 +++++ src/core/mount.c | 7 +++++++ src/core/swap.c | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/src/core/manager.c b/src/core/manager.c index c424fece5..ba4dab3b8 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -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); diff --git a/src/core/mount.c b/src/core/mount.c index bf1d43396..634dff19a 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -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); diff --git a/src/core/swap.c b/src/core/swap.c index fff613934..adcf78b71 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -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); -- 2.30.2