8 Star 0 Fork 50

src-anolis-os/systemd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0904-journald-server-always-touch-state-file-in-signal-ha.patch 2.13 KB
一键复制 编辑 原始数据 按行查看 历史
Zhao Hang 提交于 2023-12-26 10:07 . update to systemd-239-78.src.rpm
From 05a06e34ac8a38c1cff2a08ba071386141e0b78d Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 13 Mar 2023 14:32:20 +0100
Subject: [PATCH] journald-server: always touch state file in signal handler
`journalctl --relinquish-var` waits on that file, so we must create if
even if nothing has really happened.
RHEL-only
Related: #2176892
---
src/journal/journald-server.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index aa70db95cc..4788ff78bb 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1259,8 +1259,6 @@ static int dispatch_sigrtmin1(sd_event_source *es, const struct signalfd_siginfo
}
static void relinquish_var(Server *s) {
- int r;
-
assert(s);
if (s->storage == STORAGE_NONE)
@@ -1278,15 +1276,15 @@ static void relinquish_var(Server *s) {
if (unlink("/run/systemd/journal/flushed") < 0 && errno != ENOENT)
log_warning_errno(errno, "Failed to unlink /run/systemd/journal/flushed, ignoring: %m") ;
- r = write_timestamp_file_atomic("/run/systemd/journal/relinquished", now(CLOCK_MONOTONIC));
- if (r < 0)
- log_warning_errno(r, "Failed to write /run/systemd/journal/relinquished, ignoring: %m");
+ /* NOTE: We don't create our own state file here, because dispatch_sigrtmin2() has to do it anyway.
+ * But if this function is ever called from another place, the creation must be done here too. */
return;
}
static int dispatch_sigrtmin2(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
Server *s = userdata;
+ int r;
assert(s);
assert(si);
@@ -1295,6 +1293,10 @@ static int dispatch_sigrtmin2(sd_event_source *es, const struct signalfd_siginfo
relinquish_var(s);
+ r = write_timestamp_file_atomic("/run/systemd/journal/relinquished", now(CLOCK_MONOTONIC));
+ if (r < 0)
+ log_warning_errno(r, "Failed to write /run/systemd/journal/relinquished, ignoring: %m");
+
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/systemd.git
git@gitee.com:src-anolis-os/systemd.git
src-anolis-os
systemd
systemd
a8

搜索帮助