Re: [QUESTION]cgroup mount return -EBUSY

From: Lu Jialin
Date: Sun May 05 2024 - 21:50:24 EST


ping

On 2024/4/26 12:55, Lu Jialin wrote:
Hello

I encountered a problem when I try to unmount the subsystem right after
all it's subcgroups are removed, the cgroup_root would remain. Mounting
this subsystem to another cgroup_root would return -EBUSY.

The problem could be reproduced with the following script.

test.sh:

mkdir /tmp/test1
mount -t cgroup -o pids pids /tmp/test1
mkdir /tmp/test1/test
rmdir /tmp/test1/test
umount /tmp/test1
mkdir /tmp/test
mount -t cgroup -o pids,cpu none /tmp/test

test.sh should return this.
mount: mounting none on /tmp/test failed: Device or resource busy.

It seems that when unmounting /tmp/test1, the original cgroup_root for
this PID is not released.
/test # cat /proc/cgroups

#subsys_name    hierarchy       num_cgroups     enabled

cpuset  0       1       1

cpu     0       1       1

cpuacct 0       1       1

blkio   0       1       1

devices 0       1       1

freezer 0       1       1

net_cls 0       1       1

perf_event      0       1       1

net_prio        0       1       1

hugetlb 0       1       1

pids    1       1       1

rdma    0       1       1

misc    0       1       1

debug   0       1       1