Commit d150d6f2 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

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: 's avatarAndrew Vagin <avagin@virtuozzo.org>
Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 8ce58ec9
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
...@@ -141,6 +142,14 @@ static int freeze_processes(void) ...@@ -141,6 +142,14 @@ static int freeze_processes(void)
continue; continue;
if (seize_catch_task(pid) && state == frozen) { 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 */ /* fails when meets a zombie */
fclose(f); fclose(f);
goto err; goto err;
......
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