From 02c1de6f1126a75b04938376003a71b9ce1c5345 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Mon, 19 Jan 2015 17:04:14 +0300 Subject: [PATCH] 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 --- cgroups/fs/apply_raw.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cgroups/fs/apply_raw.go b/cgroups/fs/apply_raw.go index 1fe5faf3..930738bf 100644 --- a/cgroups/fs/apply_raw.go +++ b/cgroups/fs/apply_raw.go @@ -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 }