summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-11-05 13:59:17 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-11-10 17:33:32 +0100
commit5ee24fa0a09ded9d842499a251e2e939a1a26b0b (patch)
tree814f537c6a7529bf09d56587f497820614fbd949
parentpid1: expose "extrinsic" status of swaps and mounts (diff)
downloadsystemd-5ee24fa0a09ded9d842499a251e2e939a1a26b0b.tar.xz
systemd-5ee24fa0a09ded9d842499a251e2e939a1a26b0b.zip
user: move "extrinsic" units to their root slice
With the grandparent change to move most units to app.slice, those units would be ordered After=app.slice which doesn't make any sense. Actually they appear earlier, before the manager is even started, and conceputally it doesn't seem useful to put them under any slice.
-rw-r--r--src/core/unit.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index f80d9f40998..e87b951d9fa 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -3350,15 +3350,16 @@ int unit_set_default_slice(Unit *u) {
slice_name = strjoina("system-", escaped, ".slice");
else
slice_name = strjoina("app-", escaped, ".slice");
- } else {
- if (MANAGER_IS_SYSTEM(u->manager))
- slice_name =
- unit_has_name(u, SPECIAL_INIT_SCOPE)
- ? SPECIAL_ROOT_SLICE
- : SPECIAL_SYSTEM_SLICE;
- else
- slice_name = SPECIAL_APP_SLICE;
- }
+
+ } else if (unit_is_extrinsic(u))
+ /* Keep all extrinsic units (e.g. perpetual units and swap and mount units in user mode) in
+ * the root slice. They don't really belong in one of the subslices. */
+ slice_name = SPECIAL_ROOT_SLICE;
+
+ else if (MANAGER_IS_SYSTEM(u->manager))
+ slice_name = SPECIAL_SYSTEM_SLICE;
+ else
+ slice_name = SPECIAL_APP_SLICE;
r = manager_load_unit(u->manager, slice_name, NULL, NULL, &slice);
if (r < 0)