From e50bfc89cefd4aafedaf2a7eacbf8b5ed80b134e Mon Sep 17 00:00:00 2001 From: Adrian Vovk Date: Thu, 28 Mar 2024 20:38:09 -0400 Subject: [PATCH] manager: Freeze/Thaw: Don't fail units w/o cgroup Previously, it was impossible to freeze or thaw a slice if it is an ancestor to a unit that had no running cgroup (i.e. a service with RemainAfterExit=yes). Instead of failing with EBUSY (which would confusingly get reported as "Unit has pending job") we just silently no-op. I noticed this because we now have user-runtime-dir@.service, which would make it impossible to freeze/thaw user.slice or user-.slice --- src/core/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index fdca434df9..852a16622f 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -5128,7 +5128,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { CGroupRuntime *crt = unit_get_cgroup_runtime(u); if (!crt || !crt->cgroup_realized) - return -EBUSY; + return 0; /* No cgroup = nothing running to freeze */ unit_next_freezer_state(u, action, &next, &target); -- 2.25.1