[05/21] restore: Convert waited helpers and zombies pids in parent's pid_ns

Submitted by Kirill Tkhai on May 23, 2017, 12:38 p.m.

Details

Message ID 149554313483.12386.13620460431954941122.stgit@localhost.localdomain
State New
Series "Add /proc/[pid]/ns/pid_for_children ns support (and fixes)"
Headers show

Commit Message

Kirill Tkhai May 23, 2017, 12:38 p.m.
Parent waits them by pid in its active pid namespace. So,
it's need to converts them there instead of using vpid().

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/cr-restore.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index fabfb80ce..446583332 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -720,6 +720,7 @@  static int prepare_sigactions(CoreEntry *core)
 
 static int __collect_child_pids(struct pstree_item *p, int state, unsigned int *n)
 {
+	int level = current->pid->level;
 	struct pstree_item *pi;
 
 	list_for_each_entry(pi, &p->children, sibling) {
@@ -733,7 +734,7 @@  static int __collect_child_pids(struct pstree_item *p, int state, unsigned int *
 			return -1;
 
 		(*n)++;
-		*child = vpid(pi);
+		*child = pi->pid->ns[level-1].virt;
 	}
 
 	return 0;

Comments

Pavel Tikhomirov May 29, 2017, 9:47 a.m.
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

On 05/23/2017 03:38 PM, Kirill Tkhai wrote:
> Parent waits them by pid in its active pid namespace. So,
> it's need to converts them there instead of using vpid().
> 
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
> ---
>   criu/cr-restore.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index fabfb80ce..446583332 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -720,6 +720,7 @@ static int prepare_sigactions(CoreEntry *core)
>   
>   static int __collect_child_pids(struct pstree_item *p, int state, unsigned int *n)
>   {
> +	int level = current->pid->level;
>   	struct pstree_item *pi;
>   
>   	list_for_each_entry(pi, &p->children, sibling) {
> @@ -733,7 +734,7 @@ static int __collect_child_pids(struct pstree_item *p, int state, unsigned int *
>   			return -1;
>   
>   		(*n)++;
> -		*child = vpid(pi);
> +		*child = pi->pid->ns[level-1].virt;
>   	}
>   
>   	return 0;
>