mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
freezer: don't catch kernel threads
OpenVZ creates per-container kernel threads and they live in container's cgroups. CRIU should skip these threads, it's impossiable to get any state of them. Signed-off-by: Andrew Vagin <avagin@virtuozzo.org> Signed-off-by: Andrew Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
8ce58ec963
commit
d150d6f20d
9
seize.c
9
seize.c
@@ -1,6 +1,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
@@ -141,6 +142,14 @@ static int freeze_processes(void)
|
||||
continue;
|
||||
|
||||
if (seize_catch_task(pid) && state == frozen) {
|
||||
char buf[] = "/proc/XXXXXXXXXX/exe";
|
||||
struct stat st;
|
||||
|
||||
/* skip kernel threads */
|
||||
snprintf(buf, sizeof(buf), "/proc/%d/exe", pid);
|
||||
if (stat(buf, &st) == -1 && errno == ENOENT)
|
||||
continue;
|
||||
|
||||
/* fails when meets a zombie */
|
||||
fclose(f);
|
||||
goto err;
|
||||
|
Reference in New Issue
Block a user