1 Star 0 Fork 49

yuguorui96/systemd_os

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0770-unit-check-for-mount-rate-limiting-before-checking-a.patch 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
小龙 提交于 2023-01-12 18:39 . update to systemd-239-68.el8_7.1
From 4dbe6568d5bcc082b13f3ef4d323d1669f16095c Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 30 May 2022 11:55:41 +0200
Subject: [PATCH] unit: check for mount rate limiting before checking active
state
Having this check as part of mount_can_start() is too late because
UNIT(u)->can_start() virtual method is called after checking the active
state of unit in unit_start().
We need to hold off running mount start jobs when /p/s/mountinfo monitor
is rate limited even when given mount unit is already active.
Fixes #20329
(cherry picked from commit b161bc394b2cc8b271dda9208e310cc2af0cc29d)
Resolves: #2095744
---
src/core/mount.c | 3 ---
src/core/unit.c | 4 ++++
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 9547cb9b29..d37b5731f8 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1999,9 +1999,6 @@ static int mount_can_start(Unit *u) {
assert(m);
- if (sd_event_source_is_ratelimited(u->manager->mount_event_source))
- return -EAGAIN;
-
r = unit_test_start_limit(u);
if (r < 0) {
mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT);
diff --git a/src/core/unit.c b/src/core/unit.c
index c00d30e837..0810bf5a58 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1729,6 +1729,10 @@ int unit_start(Unit *u) {
assert(u);
+ /* Let's hold off running start jobs for mount units when /proc/self/mountinfo monitor is rate limited. */
+ if (u->type == UNIT_MOUNT && sd_event_source_is_ratelimited(u->manager->mount_event_source))
+ return -EAGAIN;
+
/* If this is already started, then this will succeed. Note that this will even succeed if this unit
* is not startable by the user. This is relied on to detect when we need to wait for units and when
* waiting is finished. */
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yuguorui96/systemd_os.git
git@gitee.com:yuguorui96/systemd_os.git
yuguorui96
systemd_os
systemd_os
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385