lxc / lxcfs

FUSE filesystem for LXC
https://linuxcontainers.org/lxcfs
Other
1.02k stars 246 forks source link

proc_loadavg: fix ABBA deadlock between read/refresh #606

Closed mihalicyn closed 11 months ago

mihalicyn commented 11 months ago

Idea of this fix is to always take nested locks in the same order.

At the same time, we adding an extra check to insert_node() that prevents adding a new load_node with the same cgroup (->cg field) value. This is theoretically possible because we don't hold .rilock/.lock when we call insert_node().

It looks like we have this issue from the initial implementation of loadavg virtualization and it's hardly reproducible that's why we weren't able to notice it.

Fixes: #605