[CRIU] [PATCH v2 04/13] restore: Always set real pid in restore_task_with_children()
Kirill Tkhai
ktkhai at virtuozzo.com
Tue May 16 09:26:12 PDT 2017
In next patches, root_item will need to have its real pid
to be sure, usernsd already sees it.
Also add a comment, explaning why set real pid in two places.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/cr-restore.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 26994e5d2..7a27ed5b2 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1265,8 +1265,8 @@ static int do_fork_with_pid(struct pstree_item *item, struct ns_id *pid_ns, stru
close_pid_proc();
pid = clone_noasan(restore_task_with_children, ca->clone_flags | SIGCHLD, ca);
if (item == root_item) {
+ /* We want to use it before it's set in restore_task_with_children() */
item->pid->real = pid;
- pr_debug("PID: real %d virt %d\n", pid, vpid(item));
}
return pid > 0 ? 0 : -1;
}
@@ -1661,13 +1661,10 @@ static int restore_task_with_children(void *_arg)
current = ca->item;
- if (current != root_item) {
- current->pid->real = get_self_real_pid();
- pr_debug("PID: real %d virt %d\n",
- current->pid->real, vpid(current));
- if (current->pid->real < 0)
- goto err;
- }
+ current->pid->real = get_self_real_pid();
+ pr_debug("PID: real %d virt %d\n", current->pid->real, vpid(current));
+ if (current->pid->real < 0)
+ goto err;
if ( !(ca->clone_flags & CLONE_FILES))
close_safe(&ca->fd);
More information about the CRIU
mailing list