summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-03-24 21:24:23 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-04-01 14:27:11 +0900
commit6253eb576cdde2230b75f84532f745b4409f71ad (patch)
tree2926b6b63cf214d5170d403b8f840c84a81855a7
parentc901bc8680d1835737de116f2bf1f522bdb083c2 (diff)
downloadsystemd-6253eb576cdde2230b75f84532f745b4409f71ad.tar.gz
journal-file: if we are going down, don't use event loop to schedule post
The event loop is already shutting down, hence no point in using it anymore, it's not going to run any further iteration. (cherry picked from commit 47f04c2a69d5a604411f17a2e660021165d09c89)
-rw-r--r--src/libsystemd/sd-journal/journal-file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
index 369b32856f..bac258ca42 100644
--- a/src/libsystemd/sd-journal/journal-file.c
+++ b/src/libsystemd/sd-journal/journal-file.c
@@ -1887,11 +1887,18 @@ static int post_change_thunk(sd_event_source *timer, uint64_t usec, void *userda
}
static void schedule_post_change(JournalFile *f) {
+ sd_event *e;
int r;
assert(f);
assert(f->post_change_timer);
+ assert_se(e = sd_event_source_get_event(f->post_change_timer));
+
+ /* If we are aleady going down, post the change immediately. */
+ if (IN_SET(sd_event_get_state(e), SD_EVENT_EXITING, SD_EVENT_FINISHED))
+ goto fail;
+
r = sd_event_source_get_enabled(f->post_change_timer, NULL);
if (r < 0) {
log_debug_errno(r, "Failed to get ftruncate timer state: %m");