diff --git a/src/core/main.c b/src/core/main.c index d700b3afc5..db6521b924 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2581,7 +2581,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 284e3f6b07..ffe3d4cc64 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c @@ -478,7 +478,7 @@ static int relabel_extra(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); @@ -524,7 +524,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 b4ca2cf4b4..bccd094961 100644 --- a/src/core/mount-setup.h +++ b/src/core/mount-setup.h @@ -4,7 +4,7 @@ #include int mount_setup_early(void); -int mount_setup(bool loaded_policy); +int mount_setup(bool loaded_policy, bool leave_propagation); int mount_cgroup_controllers(void);