]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: Don't setup mount propagation tunnel if not required
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 28 Oct 2025 22:00:44 +0000 (23:00 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 29 Oct 2025 11:01:02 +0000 (12:01 +0100)
If we know we have mount_setattr(), then we don't need the mount
propagation tunnel, so don't set it up.

src/core/exec-invoke.c

index 2448baa125cdd3311e4ee331df87b7c585f33fc2..27eb8bc53c194d1ba9db456adab4c8a9e4707620 100644 (file)
@@ -53,6 +53,7 @@
 #include "memfd-util.h"
 #include "mkdir-label.h"
 #include "mount-util.h"
+#include "mountpoint-util.h"
 #include "namespace-util.h"
 #include "nsflags.h"
 #include "open-file.h"
@@ -3806,13 +3807,15 @@ static int apply_mount_namespace(
                 return r;
 
         if (params->runtime_scope == RUNTIME_SCOPE_SYSTEM) {
-                propagate_dir = path_join("/run/systemd/propagate/", params->unit_id);
-                if (!propagate_dir)
-                        return -ENOMEM;
+                if (!mount_new_api_supported()) {
+                        propagate_dir = path_join("/run/systemd/propagate/", params->unit_id);
+                        if (!propagate_dir)
+                                return -ENOMEM;
 
-                incoming_dir = strdup("/run/systemd/incoming");
-                if (!incoming_dir)
-                        return -ENOMEM;
+                        incoming_dir = strdup("/run/systemd/incoming");
+                        if (!incoming_dir)
+                                return -ENOMEM;
+                }
 
                 private_namespace_dir = strdup("/run/systemd");
                 if (!private_namespace_dir)