Don't rejoin the cgroup each time
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
2616e87cad
commit
82ec5cb036
1 changed files with 8 additions and 6 deletions
|
@ -12,18 +12,20 @@ type freezerGroup struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *freezerGroup) Set(d *data) error {
|
func (s *freezerGroup) Set(d *data) error {
|
||||||
dir, err := d.join("freezer")
|
switch d.c.Freezer {
|
||||||
if err != nil {
|
case cgroups.Frozen, cgroups.Thawed:
|
||||||
if err != cgroups.ErrNotFound {
|
dir, err := d.path("freezer")
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if d.c.Freezer != cgroups.Undefined {
|
|
||||||
if err := writeFile(dir, "freezer.state", string(d.c.Freezer)); err != nil {
|
if err := writeFile(dir, "freezer.state", string(d.c.Freezer)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
if _, err := d.join("freezer"); err != nil && err != cgroups.ErrNotFound {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue