加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fix-mount-failed-while-daemon-reexec.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
hongjinghao 提交于 2023-06-19 10:57 . sync patches from systemd community
From e485f8a182f8a141676f7ffe0311a1a4724c3c1a Mon Sep 17 00:00:00 2001
From: licunlong <licunlong1@huawei.com>
Date: Tue, 28 Jun 2022 21:56:26 +0800
Subject: [PATCH] fix mount failed while daemon-reexec
---
src/core/manager.c | 1 +
src/core/manager.h | 1 +
src/core/mount.c | 5 ++++-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/core/manager.c b/src/core/manager.c
index 55adcd1..74f8304 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1808,6 +1808,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
}
manager_ready(m);
+ m->mountinfo_uptodate = false;
manager_set_switching_root(m, false);
diff --git a/src/core/manager.h b/src/core/manager.h
index 31b4670..df74200 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -259,6 +259,7 @@ struct Manager {
/* Data specific to the mount subsystem */
struct libmnt_monitor *mount_monitor;
sd_event_source *mount_event_source;
+ bool mountinfo_uptodate;
/* Data specific to the swap filesystem */
FILE *proc_swaps;
diff --git a/src/core/mount.c b/src/core/mount.c
index 8fed04c..00482e9 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1785,6 +1785,7 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
(void) mount_setup_unit(m, device, path, options, fstype, set_flags);
}
+ m->mountinfo_uptodate = true;
return 0;
}
@@ -1948,8 +1949,10 @@ static int mount_process_proc_self_mountinfo(Manager *m) {
assert(m);
r = drain_libmount(m);
- if (r <= 0)
+ if (r < 0)
return r;
+ if (r == 0 && m->mountinfo_uptodate)
+ return 0;
r = mount_load_proc_self_mountinfo(m, true);
if (r < 0) {
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化