From e5906f7ed5aae45ba39f1f0b1a17382a3fade2c9 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Mon, 29 Feb 2016 08:50:42 -0800 Subject: [PATCH] Fix race between Apply and GetStats Signed-off-by: Alexander Morozov --- libcontainer/cgroups/fs/apply_raw.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index 758d1196..6def4ea5 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -130,6 +130,8 @@ func (m *Manager) Apply(pid int) (err error) { return cgroups.EnterPid(m.Paths, pid) } + m.mu.Lock() + defer m.mu.Unlock() paths := make(map[string]string) for _, sys := range subsystems { if err := sys.Apply(d); err != nil {