forked from pool/systemd
8903d1ccb9
OBS-URL: https://build.opensuse.org/request/show/338278 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=910
50 lines
2.0 KiB
Diff
50 lines
2.0 KiB
Diff
From 6a102f90a2ee50e43998d64819e8bd4ee241c22b Mon Sep 17 00:00:00 2001
|
|
From: Franck Bui <fbui@suse.com>
|
|
Date: Thu, 8 Oct 2015 19:06:06 +0200
|
|
Subject: [PATCH 1/2] 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.
|
|
|
|
(cherry picked from commit 9b3757e9c8c8d6e161481193c4ef60e425a9ae41)
|
|
---
|
|
src/core/unit.c | 14 ++++++++++++--
|
|
1 file changed, 12 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/core/unit.c b/src/core/unit.c
|
|
index dd5e801..dc7bc5a 100644
|
|
--- a/src/core/unit.c
|
|
+++ b/src/core/unit.c
|
|
@@ -1141,13 +1141,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;
|
|
|
|
--
|
|
2.6.0
|
|
|