[lxc-devel] [lxc/master] cgfs: stab in the dark

hallyn on Github lxc-bot at linuxcontainers.org
Thu Mar 3 17:25:52 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1502 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160303/c5722fd6/attachment.bin>
-------------- next part --------------
From f69a4312e618bbf479525f771d323246e76d523d Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn at ubuntu.com>
Date: Thu, 3 Mar 2016 09:21:16 -0800
Subject: [PATCH] cgfs: stab in the dark

Tycho is reporting errors looking like:

            lxc 20160303090016.268 ERROR    lxc_cgfs - cgfs.c:lxc_cgroupfs_create:890 - Could not find writable mount point for cgroup hierarchy 13 while trying to create cgroup.
            lxc 20160303090016.268 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:210 - Read-only file system - cgroup_rmdir: failed to delete /sys/fs/cgroup/hugetlb/
            lxc 20160303090016.268 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:210 - Device or resource busy - cgroup_rmdir: failed to delete /sys/fs/cgroup/pids//init.scope
[...]
            lxc 20160303090016.270 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:210 - Read-only file system - cgroup_rmdir: failed to delete /sys/fs/cgroup/pids/

on occasional migration runs.  I've not reproduced this, but it looks
like cgroup_rmdir is trying to delete '/'.

This isn't terrible, as any populated cgroups cannot be removed, and
we don't enforce removal by killing tasks :)  But we could race with
someone doing

mkdir cgroup
move task > cgroup

So catch any case where it looks like we have not properly set a cgroup
path, and don't remove null or / cgroup.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/cgfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/cgfs.c b/src/lxc/cgfs.c
index 05e7bcf..f7a3c72 100644
--- a/src/lxc/cgfs.c
+++ b/src/lxc/cgfs.c
@@ -1245,7 +1245,7 @@ void lxc_cgroup_process_info_free_and_remove(struct cgroup_process_info *info, s
 	if (!info)
 		return;
 	next = info->next;
-	{
+	if (info->cgroup_path && strcmp(info->cgroup_path, "/") != 0) {
 		struct cgroup_mount_point *mp = info->designated_mount_point;
 		if (!mp)
 			mp = lxc_cgroup_find_mount_point(info->hierarchy, info->cgroup_path, true);


More information about the lxc-devel mailing list