Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions src/libcrun/criu.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ libcrun_container_checkpoint_linux_criu (libcrun_container_status_t *status, lib
cleanup_wrapper struct libcriu_wrapper_s *wrapper = NULL;
cleanup_free char *descriptors_path = NULL;
cleanup_free char *freezer_path = NULL;
cleanup_free char *rootfs = NULL;
cleanup_free char *path = NULL;
cleanup_close int image_fd = -1;
cleanup_close int work_fd = -1;
int cgroup_mode;
Expand Down Expand Up @@ -557,13 +557,13 @@ libcrun_container_checkpoint_linux_criu (libcrun_container_status_t *status, lib
if (UNLIKELY (ret < 0))
return crun_error_wrap (err, "error saving CRIU descriptors file");

ret = append_paths (&rootfs, err, status->bundle, status->rootfs, NULL);
ret = append_paths (&path, err, status->bundle, status->rootfs, NULL);
if (UNLIKELY (ret < 0))
return ret;

ret = libcriu_wrapper->criu_set_root (rootfs);
ret = libcriu_wrapper->criu_set_root (path);
if (UNLIKELY (ret != 0))
return crun_make_error (err, 0, "error setting CRIU root to `%s`", rootfs);
return crun_make_error (err, 0, "error setting CRIU root to `%s`", path);

cgroup_mode = libcrun_get_cgroup_mode (err);
if (UNLIKELY (cgroup_mode < 0))
Expand All @@ -586,10 +586,16 @@ libcrun_container_checkpoint_linux_criu (libcrun_container_status_t *status, lib
char buf[PATH_MAX];
const char *dest_in_root;

dest_in_root = chroot_realpath (rootfs, def->mounts[i]->destination, buf);
dest_in_root = chroot_realpath (status->rootfs, def->mounts[i]->destination, buf);
if (UNLIKELY (dest_in_root == NULL))
return crun_make_error (err, errno, "unable to resolve external bind mount `%s` under rootfs", def->mounts[i]->destination);
dest_in_root += strlen (rootfs);
{
if (errno != ENOENT)
return crun_make_error (err, errno, "unable to resolve external bind mount `%s` under rootfs", def->mounts[i]->destination);
else
dest_in_root = def->mounts[i]->destination;
}
else
dest_in_root += strlen (status->rootfs);

ret = libcriu_wrapper->criu_add_ext_mount (dest_in_root, dest_in_root);
if (UNLIKELY (ret < 0))
Expand Down Expand Up @@ -793,7 +799,6 @@ libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcru
cleanup_close int inherit_new_pid_fd = -1;
cleanup_close int image_fd = -1;
cleanup_free char *root = NULL;
cleanup_free char *rootfs = NULL;
cleanup_free char *bundle_cleanup = NULL;
cleanup_close int work_fd = -1;
int ret_out;
Expand Down Expand Up @@ -904,9 +909,6 @@ libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcru
}

/* Tell CRIU about external bind mounts. */
ret = append_paths (&rootfs, err, status->bundle, status->rootfs, NULL);
if (UNLIKELY (ret < 0))
return ret;
for (i = 0; i < def->mounts_len; i++)
{
if (is_bind_mount (def->mounts[i], NULL))
Expand All @@ -915,10 +917,15 @@ libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcru
char buf[PATH_MAX];
const char *dest_in_root;

dest_in_root = chroot_realpath (rootfs, def->mounts[i]->destination, buf);
dest_in_root = chroot_realpath (status->rootfs, def->mounts[i]->destination, buf);
if (UNLIKELY (dest_in_root == NULL))
return crun_make_error (err, errno, "unable to resolve external bind mount `%s` under rootfs", def->mounts[i]->destination);
dest_in_root += strlen (rootfs);
{
if (errno != ENOENT)
return crun_make_error (err, errno, "unable to resolve external bind mount destination `%s` under rootfs", def->mounts[i]->destination);
dest_in_root = def->mounts[i]->destination;
}
else
dest_in_root += strlen (status->rootfs);

ret = libcriu_wrapper->criu_add_ext_mount (dest_in_root, def->mounts[i]->source);
if (UNLIKELY (ret < 0))
Expand Down
1 change: 1 addition & 0 deletions tests/tmt/podman/system-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ rpm -q conmon containers-common crun podman podman-tests
bats -t /usr/share/podman/test/system/030-run.bats
bats -t /usr/share/podman/test/system/075-exec.bats
bats -t /usr/share/podman/test/system/280-update.bats
bats -t /usr/share/podman/test/system/520-checkpoint.bats