From f65517b95d9da8117d74065da3e3b4877f75731f Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 14 Oct 2017 04:19:35 +0300 Subject: [PATCH] shmem: dump shared memory before dumping namespaces page_ids is a global variable and it is used to dump shared memroy, process memory and ipc shared memory. The problem is that an IPC namespace is dumped in a child process, so page_ids isn't changed in a parent process. This patch is a quick workaround this issue. Signed-off-by: Andrei Vagin --- criu/cr-dump.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c index 8faa00b45..35ca7019e 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -1834,6 +1834,16 @@ int cr_dump_tasks(pid_t pid) if (dump_pstree(root_item)) goto err; + /* + * TODO: cr_dump_shmem has to be called before dump_namespaces(), + * because page_ids is a global variable and it is used to dump + * ipc shared memory, but an ipc namespace is dumped in a child + * process. + */ + ret = cr_dump_shmem(); + if (ret) + goto err; + if (root_ns_mask) if (dump_namespaces(root_item, root_ns_mask) < 0) goto err; @@ -1842,10 +1852,6 @@ int cr_dump_tasks(pid_t pid) if (ret) goto err; - ret = cr_dump_shmem(); - if (ret) - goto err; - ret = fix_external_unix_sockets(); if (ret) goto err;