Merge pull request #970 from hqhq/fix_race_cgroup_paths

Fix race condition when using cgroups.Paths
This commit is contained in:
Alexander Morozov 2016-08-23 10:47:00 -07:00 committed by GitHub
commit 0c6733d669
1 changed files with 2 additions and 2 deletions

View File

@ -104,6 +104,8 @@ func (m *Manager) Apply(pid int) (err error) {
if m.Cgroups == nil {
return nil
}
m.mu.Lock()
defer m.mu.Unlock()
var c = m.Cgroups
@ -128,8 +130,6 @@ 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 {