ryantimwilson / rpms / systemd

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