Unverified Commit 426b9f61 by Christian Brauner Committed by GitHub

Merge pull request #2690 from adrianreber/master

checkpoint: fix running do_dump()
parents d354a97d e20f46f8
......@@ -174,7 +174,8 @@ static int cmp_version(const char *v1, const char *v2)
return -1;
}
static void exec_criu(struct cgroup_ops *cgroup_ops, struct criu_opts *opts)
static void exec_criu(struct cgroup_ops *cgroup_ops, struct lxc_conf *conf,
struct criu_opts *opts)
{
char **argv, log[PATH_MAX];
int static_args = 23, argc = 0, i, ret;
......@@ -193,7 +194,7 @@ static void exec_criu(struct cgroup_ops *cgroup_ops, struct criu_opts *opts)
* /actual/ root cgroup so that lxcfs thinks criu has enough rights to
* see all cgroups.
*/
if (!cgroup_ops->escape(cgroup_ops, opts->handler->conf)) {
if (!cgroup_ops->escape(cgroup_ops, conf)) {
ERROR("failed to escape cgroups");
return;
}
......@@ -1065,7 +1066,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
os.console_name = c->lxc_conf->console.name;
/* exec_criu() returning is an error */
exec_criu(cgroup_ops, &os);
exec_criu(cgroup_ops, c->lxc_conf, &os);
umount(rootfs->mount);
rmdir(rootfs->mount);
goto out_fini_handler;
......@@ -1266,22 +1267,16 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
if (pid == 0) {
struct criu_opts os;
struct lxc_handler h;
struct cgroup_ops *cgroup_ops;
close(criuout[0]);
lxc_zero_handler(&h);
h.name = c->name;
cgroup_ops = cgroup_init(c->lxc_conf);
if (!cgroup_ops) {
ERROR("failed to cgroup_init()");
_exit(EXIT_FAILURE);
return -1;
}
h.cgroup_ops = cgroup_ops;
os.pipefd = criuout[1];
os.action = mode;
......@@ -1289,6 +1284,7 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
os.c = c;
os.console_name = c->lxc_conf->console.path;
os.criu_version = criu_version;
os.handler = NULL;
ret = save_tty_major_minor(opts->directory, c, os.tty_id, sizeof(os.tty_id));
if (ret < 0) {
......@@ -1297,7 +1293,7 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
}
/* exec_criu() returning is an error */
exec_criu(cgroup_ops, &os);
exec_criu(cgroup_ops, c->lxc_conf, &os);
free(criu_version);
_exit(EXIT_FAILURE);
} else {
......
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