2b68233
From 3d08427e07af2419f542c3786db2e78f0ed7c282 Mon Sep 17 00:00:00 2001
2b68233
From: Lennart Poettering <lennart@poettering.net>
2b68233
Date: Thu, 18 Feb 2016 22:51:23 +0100
2b68233
Subject: [PATCH] core: exclude .slice units from "systemctl isolate"
2b68233
2b68233
Fixes: #1969
2b68233
(cherry picked from commit 1b4cd0cf11feb7d41f2eff17f86fa55b31bb6841)
2b68233
---
2b68233
 src/core/scope.c | 3 +--
2b68233
 src/core/slice.c | 8 ++++++++
2b68233
 2 files changed, 9 insertions(+), 2 deletions(-)
2b68233
2b68233
diff --git a/src/core/scope.c b/src/core/scope.c
2b68233
index c5d0ecef04..361695c3f9 100644
2b68233
--- a/src/core/scope.c
2b68233
+++ b/src/core/scope.c
2b68233
@@ -50,8 +50,7 @@ static void scope_init(Unit *u) {
2b68233
         assert(u->load_state == UNIT_STUB);
2b68233
 
2b68233
         s->timeout_stop_usec = u->manager->default_timeout_stop_usec;
2b68233
-
2b68233
-        UNIT(s)->ignore_on_isolate = true;
2b68233
+        u->ignore_on_isolate = true;
2b68233
 }
2b68233
 
2b68233
 static void scope_done(Unit *u) {
2b68233
diff --git a/src/core/slice.c b/src/core/slice.c
2b68233
index d65364c6f4..667f61bde5 100644
2b68233
--- a/src/core/slice.c
2b68233
+++ b/src/core/slice.c
2b68233
@@ -34,6 +34,13 @@ static const UnitActiveState state_translation_table[_SLICE_STATE_MAX] = {
2b68233
         [SLICE_ACTIVE] = UNIT_ACTIVE
2b68233
 };
2b68233
 
2b68233
+static void slice_init(Unit *u) {
2b68233
+        assert(u);
2b68233
+        assert(u->load_state == UNIT_STUB);
2b68233
+
2b68233
+        u->ignore_on_isolate = true;
2b68233
+}
2b68233
+
2b68233
 static void slice_set_state(Slice *t, SliceState state) {
2b68233
         SliceState old_state;
2b68233
         assert(t);
2b68233
@@ -305,6 +312,7 @@ const UnitVTable slice_vtable = {
2b68233
         .no_instances = true,
2b68233
         .can_transient = true,
2b68233
 
2b68233
+        .init = slice_init,
2b68233
         .load = slice_load,
2b68233
 
2b68233
         .coldplug = slice_coldplug,