Fix race condition when using cgroups.Paths
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
50f0a2b1e1
commit
6ecb469b2b
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue