17aa40
From 1fb992c50f7fc6a5c399e302ba79097d36a0cedf Mon Sep 17 00:00:00 2001
eb8b6e
From: Yu Watanabe <watanabe.yu+github@gmail.com>
eb8b6e
Date: Sun, 29 Aug 2021 21:20:43 +0900
eb8b6e
Subject: [PATCH] core/mount: add implicit unit dependencies even if when mount
eb8b6e
 unit is generated from /proc/self/mountinfo
eb8b6e
eb8b6e
Hopefully fixes #20566.
eb8b6e
eb8b6e
(cherry picked from commit aebff2e7ce209fc2d75b894a3ae8b80f6f36ec11)
eb8b6e
17aa40
Resolves: #2008825
eb8b6e
---
eb8b6e
 src/core/mount.c | 6 +++++-
eb8b6e
 1 file changed, 5 insertions(+), 1 deletion(-)
eb8b6e
eb8b6e
diff --git a/src/core/mount.c b/src/core/mount.c
eb8b6e
index 73c0531158..9547cb9b29 100644
eb8b6e
--- a/src/core/mount.c
eb8b6e
+++ b/src/core/mount.c
eb8b6e
@@ -1437,6 +1437,7 @@ static int mount_setup_new_unit(
eb8b6e
                 MountSetupFlags *flags) {
eb8b6e
 
eb8b6e
         MountParameters *p;
eb8b6e
+        int r;
eb8b6e
 
eb8b6e
         assert(u);
eb8b6e
         assert(flags);
eb8b6e
@@ -1458,7 +1459,6 @@ static int mount_setup_new_unit(
eb8b6e
 
eb8b6e
         if (!mount_is_extrinsic(MOUNT(u))) {
eb8b6e
                 const char *target;
eb8b6e
-                int r;
eb8b6e
 
eb8b6e
                 target = mount_is_network(p) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
eb8b6e
                 r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true, UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT);
eb8b6e
@@ -1470,6 +1470,10 @@ static int mount_setup_new_unit(
eb8b6e
                         return r;
eb8b6e
         }
eb8b6e
 
eb8b6e
+        r = mount_add_non_exec_dependencies(MOUNT(u));
eb8b6e
+        if (r < 0)
eb8b6e
+                return r;
eb8b6e
+
eb8b6e
         unit_add_to_load_queue(u);
eb8b6e
         flags->is_mounted = true;
eb8b6e
         flags->just_mounted = true;