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.
This commit is contained in:
Lennart Poettering
2022-03-25 10:03:00 +01:00
parent 19252b2548
commit 47f04c2a69
+7
View File
@@ -1931,11 +1931,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");