]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroup: get rid of weird hack in cgfsng_escape
authorTycho Andersen <tycho.andersen@canonical.com>
Wed, 14 Sep 2016 14:53:21 +0000 (14:53 +0000)
committerTycho Andersen <tycho.andersen@canonical.com>
Fri, 16 Sep 2016 21:19:19 +0000 (15:19 -0600)
We initialized cgfsng in a strange way inside of its implementation of
escape so we could use it during checkpoint. Instead, the previous patch
does a hacky initialization in criu.c, and we can get rid of the hacks
elsewhere :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
src/lxc/cgroups/cgfsng.c

index 5b615543c403a2877daea95ec4f7af6361f7709e..0777bf39aa282e9d2bafb4d65a61103bed77363e 100644 (file)
@@ -1426,19 +1426,11 @@ static int cgfsng_nrtasks(void *hdata) {
 /* Only root needs to escape to the cgroup of its init */
 static bool cgfsng_escape()
 {
-       struct cgfsng_handler_data *d;
        int i;
-       bool ret = false;
 
        if (geteuid())
                return true;
 
-       d = cgfsng_init("criu-temp-cgfsng");
-       if (!d) {
-               ERROR("cgfsng_init failed");
-               return false;
-       }
-
        for (i = 0; hierarchies[i]; i++) {
                char *fullpath = must_make_path(hierarchies[i]->mountpoint,
                                                hierarchies[i]->base_cgroup,
@@ -1446,15 +1438,12 @@ static bool cgfsng_escape()
                if (lxc_write_to_file(fullpath, "0", 2, false) != 0) {
                        SYSERROR("Failed to escape to %s", fullpath);
                        free(fullpath);
-                       goto out;
+                       return false;
                }
                free(fullpath);
        }
 
-       ret = true;
-out:
-       free_handler_data(d);
-       return ret;
+       return true;
 }
 
 static int cgfsng_num_hierarchies(void)