Skip to content

Commit 70b3ad9

Browse files
committed
seize: enable support for frozen containers
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 <[email protected]>
1 parent dcc3b49 commit 70b3ad9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

criu/seize.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ static int check_freezer_cgroup(void)
509509
{
510510
enum freezer_state state = THAWED;
511511
int fd;
512+
int exit_code = -1;
512513

513514
BUG_ON(!freeze_cgroup_disabled);
514515

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

519520
state = get_freezer_state(fd);
520-
close(fd);
521521
if (state == FREEZER_ERROR) {
522-
return -1;
522+
goto err;
523523
}
524524

525+
origin_freezer_state = state == FREEZING ? FROZEN : state;
526+
525527
if (state != THAWED) {
526-
pr_err("One or more plugins are incompatible with the freezer cgroup in the FROZEN state.\n");
527-
return -1;
528+
pr_warn("unfreezing cgroup for plugin compatibility\n");
529+
if (freezer_write_state(fd, THAWED))
530+
goto err;
528531
}
529532

530-
return 0;
533+
exit_code = 0;
534+
goto err:
535+
close(fd);
536+
return exit_code;
531537
}
532538

533539
static int freeze_processes(void)

0 commit comments

Comments
 (0)