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