From: Adrian Vovk Date: Fri, 29 Mar 2024 00:38:09 +0000 (-0400) Subject: manager: Freeze/Thaw: Don't fail units w/o cgroup X-Git-Tag: v256-rc1~354 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e50bfc89cefd4aafedaf2a7eacbf8b5ed80b134e;p=thirdparty%2Fsystemd.git 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 --- diff --git a/src/core/cgroup.c b/src/core/cgroup.c index fdca434df9b..852a16622f1 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);