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