[lxc-devel] [lxc/master] monitor process exited by signal SIGKILL, clean cgroup resource by th…

bale-cen on Github lxc-bot at linuxcontainers.org
Sat Mar 28 01:22:02 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 483 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200327/d675c6d4/attachment.bin>
-------------- next part --------------
From 8fcb908d9f2cf4432764d944007a431001a28b10 Mon Sep 17 00:00:00 2001
From: cenxianlong <cenxianlong at huawei.com>
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 <cenxianlong at huawei.com>
---
 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 effbf11a87..f0ed0d312a 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:


More information about the lxc-devel mailing list