teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0380-mount-add-remote-fs-dependencies-if-needed-after-cha.patch

84b277
From ebbcce68c7383217ad93537ef023e85b913d0478 Mon Sep 17 00:00:00 2001
84b277
From: Chris Leech <cleech@redhat.com>
84b277
Date: Sun, 23 Nov 2014 20:33:40 -0800
84b277
Subject: [PATCH] mount: add remote-fs dependencies if needed after change
84b277
84b277
This is an attempt to add it the remote-fs dependencies to a mount unit
84b277
if the options change, like when the utab options are picked up after
84b277
mountinfo has already been processed.  It just adds the remote-fs
84b277
dependencies, leaving the local-fs ones in place.
84b277
84b277
With this change I always get mount units with proper remote-fs
84b277
dependencies when mounted with the _netdev option.
84b277
84b277
(cherry-picked from a6d305f91d722e136c29222070efed5c5d8b120b)
84b277
84b277
Resolves: #1161417
84b277
---
84b277
 src/core/mount.c | 13 +++++++++++++
84b277
 1 file changed, 13 insertions(+)
84b277
84b277
diff --git a/src/core/mount.c b/src/core/mount.c
84b277
index efa46da..a7987bf 100644
84b277
--- a/src/core/mount.c
84b277
+++ b/src/core/mount.c
84b277
@@ -1499,6 +1499,19 @@ static int mount_add_one(
84b277
                         }
84b277
                 }
84b277
 
84b277
+                if (m->running_as == SYSTEMD_SYSTEM) {
84b277
+                        const char* target;
84b277
+
84b277
+                        target = mount_needs_network(options, fstype) ?  SPECIAL_REMOTE_FS_TARGET : NULL;
84b277
+                        /* _netdev option may have shown up late, or on a
84b277
+                         * remount. Add remote-fs dependencies, even though
84b277
+                         * local-fs ones may already be there */
84b277
+                        if (target) {
84b277
+                                unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
84b277
+                                load_extras = true;
84b277
+                        }
84b277
+                }
84b277
+
84b277
                 if (u->load_state == UNIT_NOT_FOUND) {
84b277
                         u->load_state = UNIT_LOADED;
84b277
                         u->load_error = 0;