libct/cgroups/fs: access m.paths under lock

1. Prevent theoretical "concurrent map access" error to m.paths.

2. There is no need to call m.Paths -- we can access m.paths directly.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-05-07 18:30:01 -07:00
parent 51e1a0842d
commit 1d143562d2
1 changed files with 3 additions and 2 deletions

View File

@ -247,9 +247,10 @@ func (m *manager) Set(container *configs.Config) error {
return nil
}
paths := m.GetPaths()
m.mu.Lock()
defer m.mu.Unlock()
for _, sys := range m.getSubsystems() {
path := paths[sys.Name()]
path := m.paths[sys.Name()]
if err := sys.Set(path, container.Cgroups); err != nil {
if m.rootless && sys.Name() == "devices" {
continue