systemd/SOURCES/0902-journald-server-always-create-state-file-in-signal-h.patch

39 lines
1.3 KiB
Diff
Raw Normal View History

2023-11-14 19:04:46 +00:00
From 0491902d0eff9f4480ce873decc5dd29e5e189d7 Mon Sep 17 00:00:00 2001
2023-05-16 06:14:02 +00:00
From: David Tardon <dtardon@redhat.com>
Date: Mon, 13 Mar 2023 14:22:28 +0100
Subject: [PATCH] journald-server: always create state file in signal handler
`journalctl --flush` waits on that file, so we must create if even if
nothing has really happened.
RHEL-only
2023-11-14 19:04:46 +00:00
Resolves: #2176892
2023-05-16 06:14:02 +00:00
---
src/journal/journald-server.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 279a32768c..c72cb68095 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1188,6 +1188,7 @@ int server_process_datagram(sd_event_source *es, int fd, uint32_t revents, void
static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
Server *s = userdata;
+ int r;
assert(s);
@@ -1197,6 +1198,10 @@ static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *
server_sync(s);
server_vacuum(s, false);
+ r = touch("/run/systemd/journal/flushed");
+ if (r < 0)
+ log_warning_errno(r, "Failed to touch /run/systemd/journal/flushed, ignoring: %m");
+
server_space_usage_message(s, NULL);
return 0;
}