summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/automount.c22
-rw-r--r--src/mount.c24
-rw-r--r--src/swap.c22
-rw-r--r--units/dev-hugepages.automount2
-rw-r--r--units/dev-hugepages.mount1
-rw-r--r--units/dev-mqueue.automount2
-rw-r--r--units/dev-mqueue.mount1
-rw-r--r--units/proc-sys-fs-binfmt_misc.automount2
-rw-r--r--units/proc-sys-fs-binfmt_misc.mount1
-rw-r--r--units/sys-kernel-debug.automount2
-rw-r--r--units/sys-kernel-debug.mount1
-rw-r--r--units/sys-kernel-security.automount2
-rw-r--r--units/sys-kernel-security.mount1
13 files changed, 71 insertions, 12 deletions
diff --git a/src/automount.c b/src/automount.c
index 934aa5f35d..00f3736b2f 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -146,6 +146,23 @@ static int automount_add_mount_links(Automount *a) {
return 0;
}
+static int automount_add_default_dependencies(Automount *a) {
+ int r;
+
+ assert(a);
+
+ if (a->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(a), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static int automount_verify(Automount *a) {
bool b;
char *e;
@@ -201,9 +218,8 @@ static int automount_load(Unit *u) {
if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0)
return r;
- if (a->meta.default_dependencies &&
- a->meta.manager->running_as == MANAGER_SYSTEM)
- if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ if (a->meta.default_dependencies)
+ if ((r = automount_add_default_dependencies(a)) < 0)
return r;
}
diff --git a/src/mount.c b/src/mount.c
index 30390de99d..5b0bc6bdf0 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -274,6 +274,24 @@ static int mount_add_target_links(Mount *m) {
}
}
+static int mount_add_default_dependencies(Mount *m) {
+ int r;
+
+ assert(m);
+
+ if (m->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ if (!path_equal(m->where, "/"))
+ if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static int mount_verify(Mount *m) {
bool b;
char *e;
@@ -368,10 +386,8 @@ static int mount_load(Unit *u) {
if ((r = unit_add_default_cgroup(u)) < 0)
return r;
- if (m->meta.default_dependencies &&
- m->meta.manager->running_as == MANAGER_SYSTEM &&
- !path_equal(m->where, "/"))
- if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ if (m->meta.default_dependencies)
+ if ((r = mount_add_default_dependencies(m)) < 0)
return r;
}
diff --git a/src/swap.c b/src/swap.c
index 92035144ba..de468a0434 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -120,6 +120,24 @@ static int swap_add_target_links(Swap *s) {
return unit_add_dependency(UNIT(s), UNIT_BEFORE, tu, true);
}
+static int swap_add_default_dependencies(Swap *s) {
+ int r;
+
+ assert(s);
+
+ if (s->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ /* Note that by default we don't disable swap devices
+ * on shutdown. i.e. there is no umount.target
+ * conflicts here. */
+ }
+
+ return 0;
+}
+
static int swap_verify(Swap *s) {
bool b;
char *e;
@@ -185,6 +203,10 @@ static int swap_load(Unit *u) {
if ((r = swap_add_target_links(s)) < 0)
return r;
+
+ if (s->meta.default_dependencies)
+ if ((r = swap_add_default_dependencies(s)) < 0)
+ return r;
}
return swap_verify(s);
diff --git a/units/dev-hugepages.automount b/units/dev-hugepages.automount
index 4e7f8ff5a9..ab8fa7c750 100644
--- a/units/dev-hugepages.automount
+++ b/units/dev-hugepages.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Huge Pages File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/dev/hugepages
diff --git a/units/dev-hugepages.mount b/units/dev-hugepages.mount
index 2aa1c23629..e6014e54a0 100644
--- a/units/dev-hugepages.mount
+++ b/units/dev-hugepages.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Huge Pages File System
+DefaultDependencies=no
[Mount]
What=hugetlbfs
diff --git a/units/dev-mqueue.automount b/units/dev-mqueue.automount
index 4df53dcaa4..ba45b28447 100644
--- a/units/dev-mqueue.automount
+++ b/units/dev-mqueue.automount
@@ -7,7 +7,7 @@
[Unit]
Description=POSIX Message Queue File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/dev/mqueue
diff --git a/units/dev-mqueue.mount b/units/dev-mqueue.mount
index 28c757a8a5..8519df5aca 100644
--- a/units/dev-mqueue.mount
+++ b/units/dev-mqueue.mount
@@ -7,6 +7,7 @@
[Unit]
Description=POSIX Message Queue File System
+DefaultDependencies=no
[Mount]
What=mqueue
diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
index 82369c56b3..29ae05b64a 100644
--- a/units/proc-sys-fs-binfmt_misc.automount
+++ b/units/proc-sys-fs-binfmt_misc.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Arbitrary Executable File Formats File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/proc/sys/fs/binfmt_misc
diff --git a/units/proc-sys-fs-binfmt_misc.mount b/units/proc-sys-fs-binfmt_misc.mount
index 0d6b196a6f..1829c2162a 100644
--- a/units/proc-sys-fs-binfmt_misc.mount
+++ b/units/proc-sys-fs-binfmt_misc.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Arbitrary Executable File Formats File System
+DefaultDependencies=no
[Mount]
What=binfmt_misc
diff --git a/units/sys-kernel-debug.automount b/units/sys-kernel-debug.automount
index 4da3f20531..3a6306f2eb 100644
--- a/units/sys-kernel-debug.automount
+++ b/units/sys-kernel-debug.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Debug File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/sys/kernel/debug
diff --git a/units/sys-kernel-debug.mount b/units/sys-kernel-debug.mount
index 7bf08158f8..53d107260b 100644
--- a/units/sys-kernel-debug.mount
+++ b/units/sys-kernel-debug.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Debug File System
+DefaultDependencies=no
[Mount]
What=debugfs
diff --git a/units/sys-kernel-security.automount b/units/sys-kernel-security.automount
index 5d8356e513..a428e0b6c1 100644
--- a/units/sys-kernel-security.automount
+++ b/units/sys-kernel-security.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Security File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/sys/kernel/security
diff --git a/units/sys-kernel-security.mount b/units/sys-kernel-security.mount
index db9d672b60..770207f004 100644
--- a/units/sys-kernel-security.mount
+++ b/units/sys-kernel-security.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Security File System
+DefaultDependencies=no
[Mount]
What=securityfs