|
|
17b0f1 |
From d772781b2810ae71bace24cce05f255212a348ed Mon Sep 17 00:00:00 2001
|
|
|
17b0f1 |
From: Franck Bui <fbui@suse.com>
|
|
|
17b0f1 |
Date: Thu, 8 Oct 2015 19:06:06 +0200
|
|
|
17b0f1 |
Subject: [PATCH] Make sure the mount units pulled by 'RequiresMountsFor=' are
|
|
|
17b0f1 |
loaded (if they exist)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
We should make sure that mount units involved by 'RequiresMountsFor='
|
|
|
17b0f1 |
directives are really loaded if not required by any others units so
|
|
|
17b0f1 |
that Requires= dependencies on the mount units are applied and thus
|
|
|
17b0f1 |
the mount unit dependencies are started.
|
|
|
17b0f1 |
|
|
|
17b0f1 |
(cherry-picked from commit c7c89abb9edf9320246482bf4a8e0656199281ae)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
Resolves: #1619743
|
|
|
17b0f1 |
---
|
|
|
17b0f1 |
src/core/unit.c | 18 ++++++++++++++----
|
|
|
17b0f1 |
1 file changed, 14 insertions(+), 4 deletions(-)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
diff --git a/src/core/unit.c b/src/core/unit.c
|
|
|
17b0f1 |
index cfddce34d4..e8532a057d 100644
|
|
|
17b0f1 |
--- a/src/core/unit.c
|
|
|
17b0f1 |
+++ b/src/core/unit.c
|
|
|
17b0f1 |
@@ -1131,13 +1131,23 @@ static int unit_add_mount_dependencies(Unit *u) {
|
|
|
17b0f1 |
char prefix[strlen(*i) + 1];
|
|
|
17b0f1 |
|
|
|
17b0f1 |
PATH_FOREACH_PREFIX_MORE(prefix, *i) {
|
|
|
17b0f1 |
+ _cleanup_free_ char *p = NULL;
|
|
|
17b0f1 |
Unit *m;
|
|
|
17b0f1 |
|
|
|
17b0f1 |
- r = manager_get_unit_by_path(u->manager, prefix, ".mount", &m);
|
|
|
17b0f1 |
- if (r < 0)
|
|
|
17b0f1 |
- return r;
|
|
|
17b0f1 |
- if (r == 0)
|
|
|
17b0f1 |
+ p = unit_name_from_path(prefix, ".mount");
|
|
|
17b0f1 |
+ if (!p)
|
|
|
17b0f1 |
+ return -ENOMEM;
|
|
|
17b0f1 |
+
|
|
|
17b0f1 |
+ m = manager_get_unit(u->manager, p);
|
|
|
17b0f1 |
+ if (!m) {
|
|
|
17b0f1 |
+ /* Make sure to load the mount unit if
|
|
|
17b0f1 |
+ * it exists. If so the dependencies
|
|
|
17b0f1 |
+ * on this unit will be added later
|
|
|
17b0f1 |
+ * during the loading of the mount
|
|
|
17b0f1 |
+ * unit. */
|
|
|
17b0f1 |
+ (void) manager_load_unit_prepare(u->manager, p, NULL, NULL, &m);
|
|
|
17b0f1 |
continue;
|
|
|
17b0f1 |
+ }
|
|
|
17b0f1 |
if (m == u)
|
|
|
17b0f1 |
continue;
|
|
|
17b0f1 |
|