1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-24 14:50:17 +03:00

Merge pull request #1501 from fbuihuu/fix-requires-mounts-for-directives

Make sure the mount units pulled by 'RequiresMountsFor=' are loaded, if they exist
This commit is contained in:
Lennart Poettering 2015-10-09 17:04:36 +03:00
commit ce3cef2c52

View File

@ -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;