[CRIU] Re: [PATCH 09/12] dump: files tree - move subid to main list node

Pavel Emelyanov xemul at parallels.com
Fri Mar 23 16:51:32 EDT 2012


On 03/23/2012 08:24 PM, Kinsbursky Stanislav wrote:
> From: Stanislav Kinsbursky <skinsbursky at openvz.org>
> 
> Cleanup patch.
> 
> Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
> ---
>  file-ids.c |   17 ++++++++++-------
>  1 files changed, 10 insertions(+), 7 deletions(-)

> @@ -125,7 +128,7 @@ lookup_alloc_subtree(struct fd_id_entry *e, u32 genid,
>  			return this;
>  	}
>  
> -	sub = alloc_fd_id_entry(genid, pid, fd, new_entry);
> +	sub = alloc_fd_id_entry(NULL, genid, pid, fd, new_entry);

After this files with equal genid part will have subid set to 0 always and thus
their ID will be equal. This is wrong.

>
> +	if (parent) {
> +		e->u.key.subid = ++parent->u.key.subid;
> +		/* Make sure no overflow here */
> +		BUG_ON(!parent->u.key.subid);
> +	}
> 
> @@ -160,7 +163,7 @@ static struct fd_id_entry *lookup_alloc_node(u8 type, u64 genid,
>  			return lookup_alloc_subtree(this, genid, pid, fd, new_entry);
>  	}
>  
> -	e = alloc_fd_id_entry(genid, pid, fd, new_entry);
> +	e = alloc_fd_id_entry(e, genid, pid, fd, new_entry);
>  	if (!e)
>  		goto err;
>  

After this some entry (the parent one) will have its ID changed. In case we have dumped
its ID to some image before this, and we meet some file which is in reality equal to the
parent after this, we will write the new ID to the image. This is also wrong.


More information about the CRIU mailing list