cgroups: set a freezer state before calling FreezerGroup.Set()

My previous patch moved the setting of the freezer state after the Set()
command. It's wrong, because this command uses it, so we need to set the
freezer state before the command and rollback it in an error case.

Fixes: 13a5703 ("cgroups: don't change a freezer state if an operation failed")

Signed-off-by: Andrey Vagin <avagin@openvz.org>
This commit is contained in:
Andrey Vagin 2015-01-19 17:04:14 +03:00 committed by Andrew Vagin
parent dcb3bca32c
commit 02c1de6f11
1 changed files with 4 additions and 2 deletions

View File

@ -143,14 +143,16 @@ func (m *Manager) Freeze(state cgroups.FreezerState) error {
return err
}
prevState := m.Cgroups.Freezer
m.Cgroups.Freezer = state
freezer := subsystems["freezer"]
err = freezer.Set(d)
if err != nil {
m.Cgroups.Freezer = prevState
return err
}
m.Cgroups.Freezer = state
return nil
}