From 8fcb908d9f2cf4432764d944007a431001a28b10 Mon Sep 17 00:00:00 2001 From: cenxianlong Date: Sat, 28 Mar 2020 02:52:26 +0200 Subject: [PATCH] monitor process exited by signal SIGKILL, clean cgroup resource by third party Writing the value 0 to a cgroup.procs file causes the writing process to be moved to the corresponding cgroup Signed-off-by: cenxianlong --- src/lxc/cgroups/cgfsng.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index effbf11a8..f0ed0d312 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1098,10 +1098,12 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops, goto try_recursive_destroy; } - ret = lxc_write_openat(pivot_path, "cgroup.procs", pidstr, len); - if (ret != 0) { - SYSWARN("Failed to move monitor %s to \"%s\"", pidstr, pivot_path); - continue; + if (handler->monitor_pid != 0) { + ret = lxc_write_openat(pivot_path, "cgroup.procs", pidstr, len); + if (ret != 0) { + SYSWARN("Failed to move monitor %s to \"%s\"", pidstr, pivot_path); + continue; + } } try_recursive_destroy: -- 2.47.2