[CRIU] [PATCH] ns: Use generate_ns_id instead of plain lookup in dump_one_ns_file

Pavel Emelyanov xemul at parallels.com
Mon May 20 06:57:38 EDT 2013


On 05/20/2013 02:51 PM, Cyrill Gorcunov wrote:
> generate_ns_id will check for attempt to dump nested namespace
> and prompt a user accordingly.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  namespaces.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/namespaces.c b/namespaces.c
> index 5928bd5..28f55d2 100644
> --- a/namespaces.c
> +++ b/namespaces.c
> @@ -198,11 +198,9 @@ int dump_one_ns_file(int lfd, u32 id, const struct fd_parms *p)
>  	struct fd_link *link = p->link;
>  	unsigned int nsid;
>  
> -	nsid = lookup_ns_id(link->ns_kid, link->ns_d);
> -	if (!nsid) {
> -		pr_err("No NS ID with kid %u\n", link->ns_kid);
> +	nsid = generate_ns_id(p->pid, link->ns_kid, link->ns_d);

I don't quite understand this change. The generate_ will create a new ns_id
entry if required would not be found. But all the namespaces we _can_ see in
this dump have already been hashed by get_task_ns_ids before any other dumps.

> +	if (!nsid)
>  		return -1;
> -	}
>  
>  	nfe.id		= id;
>  	nfe.ns_id	= nsid;
> 




More information about the CRIU mailing list