[CRIU] [PATCH 05/11] mount: save local mount point paths on restore

Pavel Emelyanov xemul at parallels.com
Tue Aug 5 05:37:51 PDT 2014


On 08/03/2014 10:31 PM, Andrey Vagin wrote:
> On restore we add a temporary root to a mount point path. It's convinient
> for restoring mount namespaces, but real paths are used for restoring
> link-remap files.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  include/proc_parse.h | 4 ++++
>  mount.c              | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/include/proc_parse.h b/include/proc_parse.h
> index ff1ea5d..4c21055 100644
> --- a/include/proc_parse.h
> +++ b/include/proc_parse.h
> @@ -110,8 +110,12 @@ struct mount_info {
>  	 * mountpoint contains path with dot at the beginning.
>  	 * It allows to use openat, statat, etc without creating
>  	 * a temporary copy.
> +	 * On restore mountpoint contains path with a termporary root,
> +	 * if a mount is in non-root namespace.
> +	 * mountpoint + rst_off contains path w/o the termporary root.
>  	 */
>  	char		*mountpoint;
> +	int		rst_off;

I have greater idea :) Maybe we will introduce two char * field,
one called abs_mpoint and to contain the full path with temp prefix,
and the 2nd one pointing into the middle of the former, called mpoint?

>  	unsigned	flags;
>  	int		master_id;
>  	int		shared_id;
> diff --git a/mount.c b/mount.c
> index d1f1f78..544a840 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -1678,6 +1678,7 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
>  		pm->mountpoint = xmalloc(len);
>  		if (!pm->mountpoint)
>  			goto err;
> +		pm->rst_off = root_len;
>  		/*
>  		 * For bind-mounts we would also fix the root here
>  		 * too, but bind-mounts restore merges mountpoint
> 



More information about the CRIU mailing list