]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: fix deleting cgroup created on shared mnt point
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 22 Apr 2022 20:55:12 +0000 (14:55 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 22 Apr 2022 20:55:17 +0000 (14:55 -0600)
commit7f9134019910a6357ce0ab778caa50d957ef9ce3
tree8fe3651bc83c50ee6dde6e447f4e31d5721f96b6
parentfb8a49dc5551165716ff368df593a91b4f422e0d
api.c: fix deleting cgroup created on shared mnt point

cgroup v1 allows mounting of two or more controllers on a single
mount point.  This fails currently when trying to delete the cgroup
recursively for all the mounted controllers because the cgroup is
already deleted by the first controller of the share mount point and
the next controllers sharing the mount point complain about
missing cgroup path.

Fix this issue by introducing shared_mnt flag to cg_mount_table_s
struct and setting it during cgroup_init() on finding a mount point
shared by controllers and repeats the check in cgroup_find_parent()
on the error to check its share mount point and ignore the error if the
file doesn't exist, similar to ignoring if the file exists during
creation.

Fixes: https://github.com/libcgroup/libcgroup/issues/127
Reported-by: Vijayendra Lakkundi <vijayendra.lakkundi@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/api.c
src/libcgroup-internal.h