journal: sync immediately on shutting down journald

Otherwise, sd_event_add_time_relative() or sd_event_source_set_time_relative()
below will trigger assert_return().

Prompted by #30029.
This commit is contained in:
Yu Watanabe 2023-11-18 02:58:50 +09:00 committed by Luca Boccassi
parent 097445d0e4
commit 3197d778e0

View file

@ -1877,6 +1877,12 @@ int server_schedule_sync(Server *s, int priority) {
return 0;
}
if (!s->event || sd_event_get_state(s->event) == SD_EVENT_FINISHED) {
/* Shutting down the server? Let's sync immediately. */
server_sync(s);
return 0;
}
if (s->sync_scheduled)
return 0;