Skip to content

Commit

Permalink
seize: enable support for frozen containers
Browse files Browse the repository at this point in the history
Container runtimes like CRI-O and containerd utilize the freezer cgroup
to create a consistent snapshot of container rootfs changes. In this
case, the container is frozen before invoking CRIU. Once CRIU
successfully completes, a copy of the container rootfs diff is saved,
and then the container is unfrozen. To enable GPU checkpointing support
with these runtimes, we need to unfreeze the cgroup and restore it to
its original state at the end.

Fixes: #2508

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
  • Loading branch information
rst0git committed Nov 4, 2024
1 parent dcc3b49 commit 511d073
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions criu/seize.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ static int check_freezer_cgroup(void)
{
enum freezer_state state = THAWED;
int fd;
int exit_code = -1;

BUG_ON(!freeze_cgroup_disabled);

Expand All @@ -517,17 +518,22 @@ static int check_freezer_cgroup(void)
return -1;

state = get_freezer_state(fd);
close(fd);
if (state == FREEZER_ERROR) {
return -1;
goto err;
}

origin_freezer_state = state == FREEZING ? FROZEN : state;

if (state != THAWED) {
pr_err("One or more plugins are incompatible with the freezer cgroup in the FROZEN state.\n");
return -1;
pr_warn("unfreezing cgroup for plugin compatibility\n");
if (freezer_write_state(fd, THAWED))
goto err;
}

return 0;
exit_code = 0;
err:
close(fd);
return exit_code;
}

static int freeze_processes(void)
Expand Down

0 comments on commit 511d073

Please sign in to comment.