summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-09 17:04:36 +0300
committerLennart Poettering <lennart@poettering.net>2015-10-09 17:04:36 +0300
commitce3cef2c52d928709674d8447b6c49062dd14a96 (patch)
tree9da3d1341499cff3a4c2bb819e07e43364ee9acd /src/core/unit.c
parent3a3f71e5f09073552dd9b0de2058d8894e1bb4f9 (diff)
parentc7c89abb9edf9320246482bf4a8e0656199281ae (diff)
Merge pull request #1501 from fbuihuu/fix-requires-mounts-for-directives
Make sure the mount units pulled by 'RequiresMountsFor=' are loaded, if they exist
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 423caa9562..39cd89f1e3 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1147,13 +1147,23 @@ static int unit_add_mount_dependencies(Unit *u) {
char prefix[strlen(*i) + 1];
PATH_FOREACH_PREFIX_MORE(prefix, *i) {
+ _cleanup_free_ char *p = NULL;
Unit *m;
- r = manager_get_unit_by_path(u->manager, prefix, ".mount", &m);
+ r = unit_name_from_path(prefix, ".mount", &p);
if (r < 0)
return r;
- if (r == 0)
+
+ m = manager_get_unit(u->manager, p);
+ if (!m) {
+ /* Make sure to load the mount unit if
+ * it exists. If so the dependencies
+ * on this unit will be added later
+ * during the loading of the mount
+ * unit. */
+ (void) manager_load_unit_prepare(u->manager, p, NULL, NULL, &m);
continue;
+ }
if (m == u)
continue;