diff options
author | Franck Bui <fbui@suse.com> | 2015-10-08 19:06:06 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2015-10-08 21:24:22 +0200 |
commit | c7c89abb9edf9320246482bf4a8e0656199281ae (patch) | |
tree | 15a871a9bd4e392d360f0e04652e5eef86478ed6 | |
parent | 9dc5db34adbd6fa3d2ac08d9610d401ba69cde93 (diff) |
Make sure the mount units pulled by 'RequiresMountsFor=' are loaded (if they exist)
We should make sure that mount units involved by 'RequiresMountsFor='
directives are really loaded if not required by any others units so
that Requires= dependencies on the mount units are applied and thus
the mount unit dependencies are started.
-rw-r--r-- | src/core/unit.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index 3a6313e4a2..1227399e16 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; |