]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/mount: correctly set DefaultDependencies=no for mounts from mountinfo 32844/head
authorMike Yuan <me@yhndnzj.com>
Wed, 15 May 2024 13:49:00 +0000 (21:49 +0800)
committerMike Yuan <me@yhndnzj.com>
Wed, 15 May 2024 14:02:32 +0000 (22:02 +0800)
Follow-up for 3c0a1b1e70c1fe6e0b6707fab7dc86b1500d0f82

Before this commit, DefaultDependencies=no is set in
mount_add_extras(). However, when generating mount units
from /proc/self/mountinfo, we don't have a unit in memory
yet, and mount_setup_new_unit() doesn't call into
mount_add_extras().

Fixes #32838

src/core/mount.c

index e43a93ac21e2433f124bedc7710f642348f19ee7..ebafcafa923b9ee9ad577b77b84babbadd8132b2 100644 (file)
@@ -604,6 +604,9 @@ static int mount_add_non_exec_dependencies(Mount *m) {
         if (!m->where)
                 return 0;
 
+        if (mount_is_credentials(m))
+                UNIT(m)->default_dependencies = false;
+
         /* Adds in all dependencies directly responsible for ordering the mount, as opposed to dependencies
          * resulting from the ExecContext and such. */
 
@@ -650,9 +653,6 @@ static int mount_add_extras(Mount *m) {
                         return r;
         }
 
-        if (mount_is_credentials(m))
-                u->default_dependencies = false;
-
         r = unit_patch_contexts(u);
         if (r < 0)
                 return r;