[CRIU] [PATCH] net: set the root net ns after restoring all namespaces

Andrei Vagin avagin at virtuozzo.com
Fri Apr 21 18:11:04 PDT 2017


On Wed, Mar 29, 2017 at 01:25:48PM +0300, Kirill Tkhai wrote:
> On 29.03.2017 12:38, Kirill Tkhai wrote:
> > On 28.03.2017 22:56, Andrei Vagin wrote:
> >> From: Andrei Vagin <avagin at virtuozzo.com>
> >>
> >> Then we will create transport sockets and we want to know where
> >> they will be created.
> >>
> >> Cc: Kirill Tkhai <ktkhai at virtuozzo.com>
> >> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> > 
> > Looks good for me. Thanks.
> > 
> > Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> > 
> > Though, the issue with tun still remains. The patch below for reproduction
> 
> Andrew, I tried to move my patch set on this patch. It is moved not good:
> we get new rule of order of generation of net namespaces and creation of
> transport socket in usernsd. It would be more clear for further code writing
> if we stay in criu net. Maybe we stay there? I suggest to call the whole
> prepare_net_namespaces() functionality in separate function like here:

It looks ok for me. Could you prepare a patch?

> 
> diff --git a/criu/net.c b/criu/net.c
> index e06d32bc..f9d4626f 100644
> --- a/criu/net.c
> +++ b/criu/net.c
> @@ -2091,14 +2091,11 @@ static int create_net_ns(void *arg)
>  	exit(ret);
>  }
>  
> -int prepare_net_namespaces()
> +static int __prepare_net_namespaces(void *unused)
>  {
>  	struct ns_id *nsid;
>  	int ret = -1;
>  
> -	if (!(root_ns_mask & CLONE_NEWNET))
> -		return 0;
> -
>  	for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
>  		if (nsid->nd != &net_ns_desc)
>  			continue;
> @@ -2155,6 +2152,15 @@ int prepare_net_namespaces()
>  	return ret;
>  }
>  
> +
> +int prepare_net_namespaces(void)
> +{
> +	if (!(root_ns_mask & CLONE_NEWNET))
> +		return 0;
> +
> +	return call_in_child_process(__prepare_net_namespaces, NULL);
> +}
> +
>  static int do_restore_task_net_ns(struct ns_id *nsid, struct pstree_item *current)
>  {
>  	int fd;


More information about the CRIU mailing list