Skip to content

Commit

Permalink
Fix error when memory cgroup not mounted
Browse files Browse the repository at this point in the history
Fixes: opencontainers#57

Normally all cgroup subsystems are optional except device cgroup,
but memory cgroup optional was broken by:
docker-archive/libcontainer#637

This patch fixes this.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
  • Loading branch information
hqhq committed Jul 13, 2015
1 parent 0d12ac2 commit 4e24410
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libcontainer/cgroups/fs/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ type MemoryGroup struct {

func (s *MemoryGroup) Apply(d *data) error {
path, err := d.path("memory")
if err != nil && !cgroups.IsNotFound(err) {
if err != nil {
if cgroups.IsNotFound(err) {
return nil
}
return err
}
if err := os.MkdirAll(path, 0755); err != nil && !os.IsExist(err) {
Expand Down

0 comments on commit 4e24410

Please sign in to comment.