da2bf9
From 21e4d155ac04bf3b999834cd42e4773ae01bf3b3 Mon Sep 17 00:00:00 2001
da2bf9
From: Lennart Poettering <lennart@poettering.net>
da2bf9
Date: Fri, 15 Nov 2019 14:00:54 +0100
da2bf9
Subject: [PATCH] mount: do not update exec deps on mountinfo changes
da2bf9
da2bf9
Fixes: #13978
da2bf9
(cherry picked from commit bf7eedbf8f8c83d9e775c80275f98f506ec963c6)
da2bf9
da2bf9
Related: #2008825
da2bf9
---
da2bf9
 src/core/mount.c | 42 ++++++++++++++++++++++++++++--------------
da2bf9
 1 file changed, 28 insertions(+), 14 deletions(-)
da2bf9
da2bf9
diff --git a/src/core/mount.c b/src/core/mount.c
da2bf9
index 4e0a4f238a..73c0531158 100644
da2bf9
--- a/src/core/mount.c
da2bf9
+++ b/src/core/mount.c
da2bf9
@@ -535,6 +535,32 @@ static int mount_verify(Mount *m) {
da2bf9
         return 0;
da2bf9
 }
da2bf9
 
da2bf9
+static int mount_add_non_exec_dependencies(Mount *m) {
da2bf9
+        int r;
da2bf9
+        assert(m);
da2bf9
+
da2bf9
+        /* Adds in all dependencies directly responsible for ordering the mount, as opposed to dependencies
da2bf9
+         * resulting from the ExecContext and such. */
da2bf9
+
da2bf9
+        r = mount_add_device_dependencies(m);
da2bf9
+        if (r < 0)
da2bf9
+                return r;
da2bf9
+
da2bf9
+        r = mount_add_mount_dependencies(m);
da2bf9
+        if (r < 0)
da2bf9
+                return r;
da2bf9
+
da2bf9
+        r = mount_add_quota_dependencies(m);
da2bf9
+        if (r < 0)
da2bf9
+                return r;
da2bf9
+
da2bf9
+        r = mount_add_default_dependencies(m);
da2bf9
+        if (r < 0)
da2bf9
+                return r;
da2bf9
+
da2bf9
+        return 0;
da2bf9
+}
da2bf9
+
da2bf9
 static int mount_add_extras(Mount *m) {
da2bf9
         Unit *u = UNIT(m);
da2bf9
         int r;
da2bf9
@@ -558,18 +584,6 @@ static int mount_add_extras(Mount *m) {
da2bf9
                         return r;
da2bf9
         }
da2bf9
 
da2bf9
-        r = mount_add_device_dependencies(m);
da2bf9
-        if (r < 0)
da2bf9
-                return r;
da2bf9
-
da2bf9
-        r = mount_add_mount_dependencies(m);
da2bf9
-        if (r < 0)
da2bf9
-                return r;
da2bf9
-
da2bf9
-        r = mount_add_quota_dependencies(m);
da2bf9
-        if (r < 0)
da2bf9
-                return r;
da2bf9
-
da2bf9
         r = unit_patch_contexts(u);
da2bf9
         if (r < 0)
da2bf9
                 return r;
da2bf9
@@ -582,7 +596,7 @@ static int mount_add_extras(Mount *m) {
da2bf9
         if (r < 0)
da2bf9
                 return r;
da2bf9
 
da2bf9
-        r = mount_add_default_dependencies(m);
da2bf9
+        r = mount_add_non_exec_dependencies(m);
da2bf9
         if (r < 0)
da2bf9
                 return r;
da2bf9
 
da2bf9
@@ -1526,7 +1540,7 @@ static int mount_setup_existing_unit(
da2bf9
         }
da2bf9
 
da2bf9
         if (load_extras)
da2bf9
-                return mount_add_extras(MOUNT(u));
da2bf9
+                return mount_add_non_exec_dependencies(MOUNT(u));
da2bf9
 
da2bf9
         return 0;
da2bf9
 }