From 4e244108ef8089abcbf9d691f138fa6ddd01d431 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Mon, 13 Jul 2015 18:22:35 +0800 Subject: [PATCH] Fix error when memory cgroup not mounted Fixes: #57 Normally all cgroup subsystems are optional except device cgroup, but memory cgroup optional was broken by: https://github.com/docker/libcontainer/pull/637 This patch fixes this. Signed-off-by: Qiang Huang --- libcontainer/cgroups/fs/memory.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libcontainer/cgroups/fs/memory.go b/libcontainer/cgroups/fs/memory.go index a40e39d8bee..8206b1472b2 100644 --- a/libcontainer/cgroups/fs/memory.go +++ b/libcontainer/cgroups/fs/memory.go @@ -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) {