naccyde / rpms / systemd

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