From 08d2ba19693f1e03ddb51b2a9c03a5917e0ba433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 25 Aug 2025 11:43:16 +0200 Subject: [PATCH] cgroups: Fix "." parent cgroup special case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ef642fe8900fb1ee1daae6501bbd6bae3aa50d3a added a special case to avoid moving cgroups that are on the "default" slice in case of deletion. However, this special check should be done in the Parent() method instead, which ensures that the default resource controller ID is returned, instead of ".". Fixes: #11599 Signed-off-by: Fabiano FidĂȘncio --- src/runtime/pkg/resourcecontrol/cgroups.go | 2 +- src/runtime/virtcontainers/sandbox.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/runtime/pkg/resourcecontrol/cgroups.go b/src/runtime/pkg/resourcecontrol/cgroups.go index 0c6976709a..7935305abd 100644 --- a/src/runtime/pkg/resourcecontrol/cgroups.go +++ b/src/runtime/pkg/resourcecontrol/cgroups.go @@ -31,7 +31,7 @@ const ( ) func RenameCgroupPath(path string) (string, error) { - if path == "" { + if path == "" || path == "." { path = DefaultResourceControllerID } diff --git a/src/runtime/virtcontainers/sandbox.go b/src/runtime/virtcontainers/sandbox.go index 01a466bb47..257601cc92 100644 --- a/src/runtime/virtcontainers/sandbox.go +++ b/src/runtime/virtcontainers/sandbox.go @@ -2546,10 +2546,8 @@ func (s *Sandbox) resourceControllerDelete() error { } resCtrlParent := sandboxController.Parent() - if resCtrlParent != "." { - if err := sandboxController.MoveTo(resCtrlParent); err != nil { - return err - } + if err := sandboxController.MoveTo(resCtrlParent); err != nil { + return err } if err := sandboxController.Delete(); err != nil {