pstree: fix prepare_dummy_pstree after rework of PID namespace

Submitted by Mike Rapoport on June 28, 2017, 12:49 p.m.

Details

Message ID 1498654153-28465-1-git-send-email-rppt@linux.vnet.ibm.com
State Accepted
Series "pstree: fix prepare_dummy_pstree after rework of PID namespace"
Commit 758be6d6385e93576b4d1b7fa6a72c279a50b89e
Headers show

Commit Message

Mike Rapoport June 28, 2017, 12:49 p.m.
Since commit 84eedc49a (pstree: Make lookup_create_pid() able to create
tasks with pid->level > 1) the read_pstree_image function presumes that
namespaces image is already parsed.
This patch ensures that this is the case for prepare_dummy_pstree users.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
 criu/pstree.c | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/pstree.c b/criu/pstree.c
index 9ae1912..cf24c99 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -1416,6 +1416,9 @@  int prepare_dummy_pstree(void)
 	if (prepare_task_entries() == -1)
 		return -1;
 
+	if (read_ns_with_hookups())
+		return -1;
+
 	if (read_pstree_image(&dummy) == -1)
 		return -1;
 

Comments

Kirill Tkhai June 28, 2017, 3:23 p.m.
On 28.06.2017 15:49, Mike Rapoport wrote:
> Since commit 84eedc49a (pstree: Make lookup_create_pid() able to create
> tasks with pid->level > 1) the read_pstree_image function presumes that
> namespaces image is already parsed.
> This patch ensures that this is the case for prepare_dummy_pstree users.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  criu/pstree.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/criu/pstree.c b/criu/pstree.c
> index 9ae1912..cf24c99 100644
> --- a/criu/pstree.c
> +++ b/criu/pstree.c
> @@ -1416,6 +1416,9 @@ int prepare_dummy_pstree(void)
>  	if (prepare_task_entries() == -1)
>  		return -1;
>  
> +	if (read_ns_with_hookups())
> +		return -1;
> +
>  	if (read_pstree_image(&dummy) == -1)
>  		return -1;
>  
>
Andrey Vagin June 30, 2017, 12:43 a.m.
Applied, thanks
On Wed, Jun 28, 2017 at 03:49:13PM +0300, Mike Rapoport wrote:
> Since commit 84eedc49a (pstree: Make lookup_create_pid() able to create
> tasks with pid->level > 1) the read_pstree_image function presumes that
> namespaces image is already parsed.
> This patch ensures that this is the case for prepare_dummy_pstree users.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> ---
>  criu/pstree.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/criu/pstree.c b/criu/pstree.c
> index 9ae1912..cf24c99 100644
> --- a/criu/pstree.c
> +++ b/criu/pstree.c
> @@ -1416,6 +1416,9 @@ int prepare_dummy_pstree(void)
>  	if (prepare_task_entries() == -1)
>  		return -1;
>  
> +	if (read_ns_with_hookups())
> +		return -1;
> +
>  	if (read_pstree_image(&dummy) == -1)
>  		return -1;
>  
> -- 
> 2.7.4
>