Commit 350a7a98 authored by Pavel Emelyanov's avatar Pavel Emelyanov

Revert "cgroups: Add ability to reuse existing cgroup yard directory"

Reasoning: some systems have /sys/fs/cgroup stuff mounted as read-only
and we have to either remount it rw or create our own set. The former
doesn't look sane as this rw remounting is also done by ststemd, so
let's return back to manual cgyard construction.

This reverts commit 860df95f.

Conflicts:
	cgroup.c
	include/cr_options.h
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 081a5b9e
......@@ -235,9 +235,6 @@ The '<mode>' may be one of below.
Change the root cgroup the controller will be installed into. No controller
means that root is the default for all controllers not specified.
*--cgroup-yard* '<dir>'::
Use directory '<dir>' as cgroups yard instead of /sys/fs/cgroup.
*--tcp-established*::
Restore previously dumped established TCP connections. This implies that
the network has been locked between *dump* and *restore* phases so other
......
......@@ -935,10 +935,14 @@ int prepare_task_cgroup(struct pstree_item *me)
void fini_cgroup(void)
{
if (cg_yard) {
if (!cg_yard)
return;
close_service_fd(CGROUP_YARD);
umount2(cg_yard, MNT_DETACH);
rmdir(cg_yard);
xfree(cg_yard);
cg_yard = NULL;
}
}
static int restore_cgroup_prop(const CgroupPropEntry * cg_prop_entry_p,
......@@ -1130,14 +1134,33 @@ static int prepare_cgroup_sfd(CgroupEntry *ce)
int off, i, ret;
char paux[PATH_MAX];
pr_info("Preparing cgroups yard (cgroups restore mode %#x)\n",
opts.manage_cgroups);
if (!opts.manage_cgroups)
return 0;
cg_yard = opts.cg_yard;
off = strlen(opts.cg_yard);
strcpy(paux, opts.cg_yard);
pr_info("Preparing cgroups yard (cgroups restore mode %#x)\n",
opts.manage_cgroups);
off = sprintf(paux, ".criu.cgyard.XXXXXX");
if (mkdtemp(paux) == NULL) {
pr_perror("Can't make temp cgyard dir");
return -1;
}
cg_yard = xstrdup(paux);
if (!cg_yard) {
rmdir(paux);
return -1;
}
if (mount("none", cg_yard, "tmpfs", 0, NULL)) {
pr_perror("Can't mount tmpfs in cgyard");
goto err;
}
if (mount("none", cg_yard, NULL, MS_PRIVATE, NULL)) {
pr_perror("Can't make cgyard private");
goto err;
}
pr_debug("Opening %s as cg yard\n", cg_yard);
i = open(cg_yard, O_DIRECTORY);
......
......@@ -56,7 +56,6 @@ void init_opts(void)
INIT_LIST_HEAD(&opts.inherit_fds);
INIT_LIST_HEAD(&opts.new_cgroup_roots);
opts.cg_yard = "/sys/fs/cgroup";
opts.cpu_cap = CPU_CAP_DEFAULT;
opts.manage_cgroups = CG_MODE_DEFAULT;
opts.ps_socket = -1;
......@@ -235,7 +234,6 @@ int main(int argc, char *argv[], char *envp[])
{ "enable-fs", required_argument, 0, 1065 },
{ "enable-external-sharing", no_argument, 0, 1066 },
{ "enable-external-masters", no_argument, 0, 1067 },
{ "cgroup-yard", required_argument, 0, 1068 },
{ },
};
......@@ -464,9 +462,6 @@ int main(int argc, char *argv[], char *envp[])
case 1067:
opts.enable_external_masters = true;
break;
case 1068:
opts.cg_yard = optarg;
break;
case 'M':
{
char *aux;
......@@ -708,7 +703,6 @@ usage:
" change the root cgroup the controller will be\n"
" installed into. No controller means that root is the\n"
" default for all controllers not specified.\n"
" --cgroup-yard DIR use DIR as premounted cgroups external yard\n"
" --skip-mnt PATH ignore this mountpoint when dumping the mount namespace.\n"
" --enable-fs FSNAMES a comma separated list of filesystem names or \"all\".\n"
" force criu to (try to) dump/restore these filesystem's\n"
......
......@@ -72,7 +72,6 @@ struct cr_options {
bool force_irmap;
char **exec_cmd;
unsigned int manage_cgroups;
char *cg_yard;
char *new_global_cg_root;
struct list_head new_cgroup_roots;
bool autodetect_ext_mounts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment