[CRIU] [PATCH 1/3] ns: Override fake pid in rst_add_ns_id()

Andrei Vagin avagin at virtuozzo.com
Tue Feb 28 17:01:14 PST 2017


On Tue, Feb 28, 2017 at 04:41:43PM +0300, Kirill Tkhai wrote:
> During reading of ns file, we add namespaces with fake pid -1.
> Allow to override it later with real pid of a process.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  criu/namespaces.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/criu/namespaces.c b/criu/namespaces.c
> index 992cd17e0..b1e65df43 100644
> --- a/criu/namespaces.c
> +++ b/criu/namespaces.c
> @@ -320,7 +320,7 @@ int rst_add_ns_id(unsigned int id, struct pstree_item *i, struct ns_desc *nd)
>  
>  	nsid = lookup_ns_by_id(id, nd);
>  	if (nsid) {
> -		if (pid_rst_prio(pid, nsid->ns_pid))
> +		if (nsid->ns_pid == -1 || pid_rst_prio(pid, nsid->ns_pid))

Where is ns_pid used on restore?

>  			nsid->ns_pid = pid;
>  		return 0;
>  	}
> 


More information about the CRIU mailing list