[CRIU] [PATCH 1/2] cgroups: Add ability to reuse existing cgroup yard directory

Cyrill Gorcunov gorcunov at gmail.com
Thu Jun 11 10:51:46 PDT 2015


On Thu, Jun 11, 2015 at 08:34:54PM +0300, Pavel Emelyanov wrote:
> > +	cg_yard = opts.cg_yard;
> > +	off = strlen(opts.cg_yard);
> >  
> >  	pr_debug("Opening %s as cg yard\n", cg_yard);
> >  	i = open(cg_yard, O_DIRECTORY);
> 
> Here below the mkdir + mount code comes. I think it should be removed as if
> we take the cgyard from even /sys/fs/cgroup all the (interesting) controllers
> are already there.

On top attached.
-------------- next part --------------
>From b0f0c427d328e7214895e1be207070e930309560 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Thu, 11 Jun 2015 20:50:53 +0300
Subject: [PATCH] cgroup: Drop mounting controllers

They should be present already.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cgroup.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/cgroup.c b/cgroup.c
index 75a8f8be04d7..7646702c5c05 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -1167,19 +1167,6 @@ static int prepare_cgroup_sfd(CgroupEntry *ce)
 				paux + ctl_off, sizeof(paux) - ctl_off,
 				opt, sizeof(opt));
 
-		/* Create controller if not yet present */
-		if (access(paux, F_OK)) {
-			pr_debug("\tMaking controller dir %s (%s)\n", paux, opt);
-			if (mkdir(paux, 0700)) {
-				pr_perror("\tCan't make controller dir %s", paux);
-				return -1;
-			}
-			if (mount("none", paux, "cgroup", 0, opt) < 0) {
-				pr_perror("\tCan't mount controller dir %s", paux);
-				return -1;
-			}
-		}
-
 		/*
 		 * Finally handle all cgroups for this controller.
 		 */
-- 
2.4.2



More information about the CRIU mailing list