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:
parent
dcb3bca32c
commit
02c1de6f11
|
@ -143,14 +143,16 @@ func (m *Manager) Freeze(state cgroups.FreezerState) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prevState := m.Cgroups.Freezer
|
||||||
|
m.Cgroups.Freezer = state
|
||||||
|
|
||||||
freezer := subsystems["freezer"]
|
freezer := subsystems["freezer"]
|
||||||
err = freezer.Set(d)
|
err = freezer.Set(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
m.Cgroups.Freezer = prevState
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Cgroups.Freezer = state
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue