From acf23ca53402e88beef8a56359e74505c58f3813 Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68@huawei.com>
Date: Thu, 17 Jan 2019 03:49:16 -0500
Subject: [PATCH 046/131] Do not test cgroup writeable

If we run isulad in docker without cgroup namespace, the base_cgroup will be docker/XXX..,
mountpoint+base_cgroup may be not exist

Signed-off-by: LiFeng <lifeng68@huawei.com>
---
 src/lxc/cgroups/cgfsng.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 47b12a64..6bfa693e 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -581,7 +581,7 @@ static bool cg_legacy_handle_cpuset_hierarchy(struct hierarchy *h, char *cgname)
 	if (slash)
 		*slash = '/';
 
-	ret = mkdir(cgpath, 0755);
+	ret = mkdir_p(cgpath, 0755);
 	if (ret < 0) {
 		if (errno != EEXIST) {
 			SYSERROR("Failed to create directory \"%s\"", cgpath);
@@ -2489,13 +2489,17 @@ static bool cg_hybrid_init(struct cgroup_ops *ops)
 
 		trim(base_cgroup);
 		prune_init_scope(base_cgroup);
+
+		/* isulad:
+		 * do not test writeable, if we run isulad in docker without cgroup namespace.
+		 * the base_cgroup will be docker/XXX.., mountpoint+base_cgroup may be not exist
 		if (type == CGROUP2_SUPER_MAGIC)
 			writeable = test_writeable_v2(mountpoint, base_cgroup);
 		else
 			writeable = test_writeable_v1(mountpoint, base_cgroup);
 		if (!writeable)
 			goto next;
-
+		*/
 		if (type == CGROUP2_SUPER_MAGIC) {
 			char *cgv2_ctrl_path;
 
-- 
2.23.0

