Skip to content

Commit 2236eb0

Browse files
committed
cgroup2: Manager.Delete: handle both "threaded" and "domain threaded"
commit 6f5001d added special handling for threaded cgroup types. A later contribution added detection for "domain threaded" as known type, but did not update the handling to detect this type. From the original PR; > Reading cgroup.procs seems to return ENOTSUPP when threaded, so check > the type of the cg when going to delete and read the relevant file. An alternative could be to check both variants unconditionally, and to error if either Manager.Threads or Manager.Procs is non-zero. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 0896ceb commit 2236eb0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cgroup2/manager.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,6 @@ func (c *Manager) fallbackKill() error {
472472
}
473473

474474
func (c *Manager) Delete() error {
475-
var (
476-
tasks []uint64
477-
threaded bool
478-
)
479475
// Kernel prevents cgroups with running process from being removed,
480476
// check the tree is empty.
481477
//
@@ -485,13 +481,13 @@ func (c *Manager) Delete() error {
485481
if !os.IsNotExist(err) {
486482
return err
487483
}
488-
} else {
489-
threaded = cgType == Threaded
490484
}
491485

492-
if threaded {
486+
var tasks []uint64
487+
switch cgType {
488+
case Threaded, DomainThreaded:
493489
tasks, err = c.Threads(true)
494-
} else {
490+
default:
495491
tasks, err = c.Procs(true)
496492
}
497493
if err != nil {

0 commit comments

Comments
 (0)