From 47f16e89df2aedc71dba3090dafb3d11f7d4dcbc Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 19 Feb 2016 11:23:30 -0800 Subject: [PATCH] Move the process outside of the systemd cgroup If you don't move the process out of the named cgroup for systemd then systemd will try to delete all the cgroups that the process is currently in. Signed-off-by: Michael Crosby --- libcontainer/cgroups/fs/apply_raw.go | 1 + libcontainer/cgroups/fs/name.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index 5d975793c..758d11962 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -31,6 +31,7 @@ var ( &NetPrioGroup{}, &PerfEventGroup{}, &FreezerGroup{}, + &NameGroup{GroupName: "name=systemd", Join: true}, } CgroupProcesses = "cgroup.procs" HugePageSizes, _ = cgroups.GetHugePageSize() diff --git a/libcontainer/cgroups/fs/name.go b/libcontainer/cgroups/fs/name.go index 0e423f667..d8cf1d87c 100644 --- a/libcontainer/cgroups/fs/name.go +++ b/libcontainer/cgroups/fs/name.go @@ -9,6 +9,7 @@ import ( type NameGroup struct { GroupName string + Join bool } func (s *NameGroup) Name() string { @@ -16,6 +17,10 @@ func (s *NameGroup) Name() string { } func (s *NameGroup) Apply(d *cgroupData) error { + if s.Join { + // ignore errors if the named cgroup does not exist + d.join(s.GroupName) + } return nil } @@ -24,6 +29,9 @@ func (s *NameGroup) Set(path string, cgroup *configs.Cgroup) error { } func (s *NameGroup) Remove(d *cgroupData) error { + if s.Join { + removePath(d.path(s.GroupName)) + } return nil }