[CRIU] [PATCH 2/4] mount: add support for external block devices

Pavel Emelyanov xemul at virtuozzo.com
Mon Apr 18 09:36:52 PDT 2016


On 04/15/2016 01:19 AM, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
> 
> It works like enable-fs, in this case we allow to mount a specified block device.
> 
> Options:
> dump:		--external mnt[MAJOR:MINOR]
> restore:	--mnt-ext-map mnt[MAJOR:MINOR]:DEVPATH

We don't have --mnt-ext-map option :\

Please, explain what the option arguments mean.

> https://jira.sw.ru/browse/PSBM-39381
> 
> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
>  criu/crtools.c    |  1 +
>  criu/mount.c      | 11 +++++++++++
>  criu/proc_parse.c | 10 ++++++++++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/criu/crtools.c b/criu/crtools.c
> index 02a24e7..3598b1b 100644
> --- a/criu/crtools.c
> +++ b/criu/crtools.c
> @@ -882,6 +882,7 @@ usage:
>  "                        Formats of RES:\n"
>  "                            tty[rdev:dev]\n"
>  "                            file[mnt_id:inode]\n"
> +"                            mnt[MAJOR/MINOR]\n"
>  "  --inherit-fd fd[<num>]:<existing>\n"
>  "                        Inherit file descriptors. This allows to treat file descriptor\n"
>  "                        <num> as being already opened via <existing> one and instead of\n"
> diff --git a/criu/mount.c b/criu/mount.c
> index f57b10c..85eeeda 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -1818,6 +1818,8 @@ static struct fstype *__find_fstype_by_name(char *fst, bool force_auto)
>  {
>  	int i;
>  
> +	if (fst == (void *) FSTYPE__AUTO)
> +		return &fstypes[1];
>  	/*
>  	 * This fn is required for two things.
>  	 * 1st -- to check supported filesystems (as just mounting
> @@ -2091,6 +2093,15 @@ static char *resolve_source(struct mount_info *mi)
>  
>  	if (mi->fstype->code == FSTYPE__AUTO) {
>  		struct stat st;
> +		char devstr[64];
> +		struct ext_mount *key;
> +
> +		snprintf(devstr, sizeof(devstr), "mnt[%d/%d]",
> +				kdev_major(mi->s_dev), kdev_minor(mi->s_dev));
> +
> +		key = ext_mount_lookup(devstr);
> +		if (key)
> +			return key->val;
>  
>  		if (!stat(mi->source, &st) && S_ISBLK(st.st_mode) &&
>  		    major(st.st_rdev) == kdev_major(mi->s_dev) &&
> diff --git a/criu/proc_parse.c b/criu/proc_parse.c
> index 2dd8dc4..55f0f5e 100644
> --- a/criu/proc_parse.c
> +++ b/criu/proc_parse.c
> @@ -1292,6 +1292,16 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
>  
>  	new->fstype = find_fstype_by_name(*fsname);
>  
> +	if (new->fstype->code == FSTYPE__UNSUPPORTED) {
> +		char devstr[64];
> +
> +		snprintf(devstr, sizeof(devstr), "mnt[%d/%d]",
> +				kdev_major(new->s_dev),  kdev_minor(new->s_dev));
> +
> +		if (external_lookup_id(devstr))
> +			new->fstype = find_fstype_by_name((void *)FSTYPE__AUTO);
> +	}
> +
>  	new->options = xmalloc(strlen(opt) + 1);
>  	if (!new->options)
>  		goto err;
> 



More information about the CRIU mailing list