1 Star 0 Fork 48

山竹/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
10005-mount-setup-change-the-system-mount-propagation-to-s.patch 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
庞庆 提交于 2022-04-19 15:08 . Add optimized patches
From 0c7f29561634f9374c0d9042304f4d4caa4242f0 Mon Sep 17 00:00:00 2001
From: Wen Yang <wenyang@linux.alibaba.com>
Date: Tue, 19 Apr 2022 13:50:04 +0800
Subject: [PATCH] mount-setup: change the system mount propagation to
---
src/core/main.c | 2 +-
src/core/mount-setup.c | 4 ++--
src/core/mount-setup.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/core/main.c b/src/core/main.c
index db91151..81dae1c 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -2519,7 +2519,7 @@ int main(int argc, char *argv[]) {
if (!skip_setup)
kmod_setup();
- r = mount_setup(loaded_policy);
+ r = mount_setup(loaded_policy, skip_setup);
if (r < 0) {
error_message = "Failed to mount API filesystems";
goto finish;
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index a659458..9f9f953 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -400,7 +400,7 @@ static int relabel_cgroup_filesystems(void) {
}
#endif
-int mount_setup(bool loaded_policy) {
+int mount_setup(bool loaded_policy, bool leave_propagation) {
int r = 0;
r = mount_points_setup(ELEMENTSOF(mount_table), loaded_policy);
@@ -444,7 +444,7 @@ int mount_setup(bool loaded_policy) {
* needed. Note that we set this only when we are invoked directly by the kernel. If we are invoked by a
* container manager we assume the container manager knows what it is doing (for example, because it set up
* some directories with different propagation modes). */
- if (detect_container() <= 0)
+ if (detect_container() <= 0 && !leave_propagation)
if (mount(NULL, "/", NULL, MS_REC|MS_SHARED, NULL) < 0)
log_warning_errno(errno, "Failed to set up the root directory for shared mount propagation: %m");
diff --git a/src/core/mount-setup.h b/src/core/mount-setup.h
index 43cd890..7a011b2 100644
--- a/src/core/mount-setup.h
+++ b/src/core/mount-setup.h
@@ -4,7 +4,7 @@
#include <stdbool.h>
int mount_setup_early(void);
-int mount_setup(bool loaded_policy);
+int mount_setup(bool loaded_policy, bool leave_propagation);
int mount_cgroup_controllers(char ***join_controllers);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangpingping000/systemd.git
git@gitee.com:wangpingping000/systemd.git
wangpingping000
systemd
systemd
a8

搜索帮助