Skip to contentSkip to conversation

mount cgroup with "already mounted or cgroup busy"

DISCUSSION Li,Rongqing 2 participants 2 messages Oct 30, 2019 – Nov 22, 2019 cgroup

lore
Share & tools
lore
#0 lore raw

Hi:

I meet a issue, and not sure if it is normal
Using the below script, the last line mount will fail after unmount And it will fail until reboot system

mount -t cgroup -o cpu,cpuset xx cgroup
mkdir cgroup/x
rmdir cgroup/x
umount cgroup
mount -t cgroup -o cpu xx cgroup
mount: xx already mounted or cgroup busy

but if I add sleep, it will success

mount -t cgroup -o cpu,cpuset xx cgroup
mkdir cgroup/x
rmdir cgroup/x
sleep 10 <<<<==========
umount cgroup
mount -t cgroup -o cpu xx cgroup

- Li RongQing

maintainer
#1 lore raw

Hello Li.

Quoted 1 line · Li,Rongqing

I meet a issue, and not sure if it is normal

It is a consequence of how cgroup state is retained.

I considered a "trivial" fix, however, I learnt later it'd be a revert (and hence regression) of
3c606d35fe97 "cgroup: prevent mount hang due to memory controller lifetime"

Quoted 2 lines

Using the below script, the last line mount will fail after unmount And it will fail until reboot system

The cause is that controllers remained pinned to the same root. You can unpin them by mounting/unmounting again attached to the same root (i.e. cpu,cpuset again).

(Perhaps the logic in cgroup1_root_to_use may be changed to cope better with the "stateless" controllers.)

Michal