1 Star 0 Fork 91

wuzx / systemd

forked from src-openEuler / systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-core-Make-sure-cgroup_oom_queue-is-flushed-on-manage.patch 2.55 KB
一键复制 编辑 原始数据 按行查看 历史
From 59894983693d36c6017ad995864b5541d7132563 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com>
Date: Wed, 4 Aug 2021 18:59:35 +0200
Subject: [PATCH] core: Make sure cgroup_oom_queue is flushed on manager exit
The unit queues are not serialized/deserialized (they are recreated
after reexec/reload instead). The destroyed units are not removed from
the cgroup_oom_queue. That means the queue may contain possibly invalid
pointers to released units.
Fix this by removing the units from cgroup_oom_queue as we do for
others. When at it, sync assert checks with currently existing queues
and put them in order in the manager cleanup code.
(cherry picked from commit 13e721036bf4ba15eb255d8f0a14800f969ac0d7)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/59894983693d36c6017ad995864b5541d7132563
---
src/core/manager.c | 4 ++++
src/core/unit.c | 7 +++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/core/manager.c b/src/core/manager.c
index 8884437347..34891a8754 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1410,6 +1410,10 @@ static void manager_clear_jobs_and_units(Manager *m) {
assert(!m->cleanup_queue);
assert(!m->gc_unit_queue);
assert(!m->gc_job_queue);
+ assert(!m->cgroup_realize_queue);
+ assert(!m->cgroup_empty_queue);
+ assert(!m->cgroup_oom_queue);
+ assert(!m->target_deps_queue);
assert(!m->stop_when_unneeded_queue);
assert(!m->start_when_upheld_queue);
assert(!m->stop_when_bound_queue);
diff --git a/src/core/unit.c b/src/core/unit.c
index 7e3bd7505e..e469beb534 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -733,6 +733,9 @@ Unit* unit_free(Unit *u) {
if (u->in_dbus_queue)
LIST_REMOVE(dbus_queue, u->manager->dbus_unit_queue, u);
+ if (u->in_cleanup_queue)
+ LIST_REMOVE(cleanup_queue, u->manager->cleanup_queue, u);
+
if (u->in_gc_queue)
LIST_REMOVE(gc_queue, u->manager->gc_unit_queue, u);
@@ -742,8 +745,8 @@ Unit* unit_free(Unit *u) {
if (u->in_cgroup_empty_queue)
LIST_REMOVE(cgroup_empty_queue, u->manager->cgroup_empty_queue, u);
- if (u->in_cleanup_queue)
- LIST_REMOVE(cleanup_queue, u->manager->cleanup_queue, u);
+ if (u->in_cgroup_oom_queue)
+ LIST_REMOVE(cgroup_oom_queue, u->manager->cgroup_oom_queue, u);
if (u->in_target_deps_queue)
LIST_REMOVE(target_deps_queue, u->manager->target_deps_queue, u);
--
2.33.0
1
https://gitee.com/wuzx065891/systemd.git
git@gitee.com:wuzx065891/systemd.git
wuzx065891
systemd
systemd
master

搜索帮助