restore: Fix waited task pid

Submitted by Kirill Tkhai on July 6, 2017, 2:33 p.m.

Details

Message ID 149935148481.20268.409427588772710989.stgit@localhost.localdomain
State Accepted
Series "restore: Fix waited task pid"
Commit f136b58c2ffd1ec3cfb9c659ff96ec8584047c2a
Headers show

Commit Message

Kirill Tkhai July 6, 2017, 2:33 p.m.
The pid must be taken relative to the parent pid namespace.

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 965770f48..e14fa0694 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1083,10 +1083,11 @@  static unsigned long task_entries_pos;
 
 static int wait_on_helpers_zombies(void)
 {
+	int level = current->pid->level;
 	struct pstree_item *pi;
 
 	list_for_each_entry(pi, &current->children, sibling) {
-		pid_t pid = vpid(pi);
+		pid_t pid = pi->pid->ns[level-1].virt;
 		int status;
 
 		switch (pi->pid->state) {

Comments

Pavel Tikhomirov July 6, 2017, 2:39 p.m.
On 07/06/2017 05:33 PM, Kirill Tkhai wrote:
> The pid must be taken relative to the parent pid namespace.
> 
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>

Acked-by: Pavel Tikhomirov <ptikhomirov@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 965770f48..e14fa0694 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -1083,10 +1083,11 @@ static unsigned long task_entries_pos;
>   
>   static int wait_on_helpers_zombies(void)
>   {
> +	int level = current->pid->level;
>   	struct pstree_item *pi;
>   
>   	list_for_each_entry(pi, &current->children, sibling) {
> -		pid_t pid = vpid(pi);
> +		pid_t pid = pi->pid->ns[level-1].virt;
>   		int status;
>   
>   		switch (pi->pid->state) {
>
Andrey Vagin July 7, 2017, 4:31 p.m.
Applied, thanks
On Thu, Jul 06, 2017 at 05:33:16PM +0300, Kirill Tkhai wrote:
> The pid must be taken relative to the parent pid namespace.
> 
> 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 965770f48..e14fa0694 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -1083,10 +1083,11 @@ static unsigned long task_entries_pos;
>  
>  static int wait_on_helpers_zombies(void)
>  {
> +	int level = current->pid->level;
>  	struct pstree_item *pi;
>  
>  	list_for_each_entry(pi, &current->children, sibling) {
> -		pid_t pid = vpid(pi);
> +		pid_t pid = pi->pid->ns[level-1].virt;
>  		int status;
>  
>  		switch (pi->pid->state) {
>