1 Star 0 Fork 98

misaka00251/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-core-really-skip-automatic-restart-when-a-JOB_STOP-j.patch 2.16 KB
一键复制 编辑 原始数据 按行查看 历史
From b17f9c7c8db6959227cebf1b30ed1698d024382e Mon Sep 17 00:00:00 2001
From: Franck Bui <fbui@suse.com>
Date: Fri, 18 Feb 2022 10:06:24 +0100
Subject: [PATCH] core: really skip automatic restart when a JOB_STOP job is
pending
It's not clear why we rescheduled a service auto restart while a stop job for
the unit was pending. The comment claims that the unit shouldn't be restarted
but the code did reschedule an auto restart meanwhile.
In practice that was rarely an issue because the service waited for the next
auto restart to be rescheduled, letting the queued stop job to be proceed and
service_stop() to be called preventing the next restart to complete.
However when RestartSec=0, the timer expired right away making PID1 to
reschedule the unit again, making the timer expired right away... and so
on. This busy loop prevented PID1 to handle any queued jobs (and hence giving
no chance to the start rate limiting to trigger), which made the busy loop last
forever.
This patch breaks this loop by skipping the reschedule of the unit auto restart
and hence not depending on the value of u->restart_usec anymore.
Fixes: #13667
(cherry picked from commit c972880640ee19e89ce9265d8eae1b3aae190332)
(cherry picked from commit 2198c08d0786c5cec1b39283831969b2cc1adf40)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/b17f9c7c8db6959227cebf1b30ed1698d024382e
---
src/core/service.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index a480edc439..21bf3dc28c 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2267,12 +2267,7 @@ static void service_enter_restart(Service *s) {
if (unit_has_job_type(UNIT(s), JOB_STOP)) {
/* Don't restart things if we are going down anyway */
- log_unit_info(UNIT(s), "Stop job pending for unit, delaying automatic restart.");
-
- r = service_arm_timer(s, usec_add(now(CLOCK_MONOTONIC), s->restart_usec));
- if (r < 0)
- goto fail;
-
+ log_unit_info(UNIT(s), "Stop job pending for unit, skipping automatic restart.");
return;
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/misaka00251/systemd.git
git@gitee.com:misaka00251/systemd.git
misaka00251
systemd
systemd
master

搜索帮助