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

Andrew Vagin avagin at virtuozzo.com
Fri May 6 16:56:14 PDT 2016


On Fri, May 06, 2016 at 08:21:58PM +0300, Pavel Emelyanov wrote:
> 
> >>> @@ -878,9 +873,12 @@ usage:
> >>>  "                        force criu to (try to) dump/restore these filesystem's\n"
> >>>  "                        mountpoints even if fs is not supported.\n"
> >>>  "  --external RES        dump objects from this list as external resources:\n"
> >>> -"                        Formats of RES:\n"
> >>> +"                        Formats of RES on dump:\n"
> >>>  "                            tty[rdev:dev]\n"
> >>>  "                            file[mnt_id:inode]\n"
> >>> +"                            dev[maj:min]:VAL\n"
> >>> +"                        Formats of RES on restore:\n"
> >>> +"                            VAL:DEVPATH\n"
> >>
> >> DEVPATH? This looks like --external for restore is device-only feature, while
> >> it should not be such.
> > 
> > Currently VAL is used only with the dev[maj:min] key, so here is only
> > DEVPATH now. In a future we can add new key:value pairs.
> 
> OK, but let's make this option have the same syntax for restore as it is for
> dump. E.g. --external dev[VAL]:DEVPATH or smth like this.
> 
> >>> @@ -487,15 +489,33 @@ static void mnt_tree_show(struct mount_info *tree, int off)
> >>>  static int try_resolve_ext_mount(struct mount_info *info)
> >>>  {
> >>>  	struct ext_mount *em;
> >>> +	char devstr[64];
> >>>  
> >>>  	em = ext_mount_lookup(info->mountpoint + 1 /* trim the . */);
> >>> -	if (em == NULL)
> >>> -		return -ENOTSUP;
> >>> +	if (em) {
> >>> +		pr_info("Found %s mapping for %s mountpoint\n",
> >>> +				em->val, info->mountpoint);
> >>> +		info->external = em;
> >>> +		return 0;
> >>> +	}
> >>>  
> >>> -	pr_info("Found %s mapping for %s mountpoint\n",
> >>> -			em->val, info->mountpoint);
> >>> -	info->external = em;
> >>> -	return 0;
> >>> +	snprintf(devstr, sizeof(devstr), "dev[%d/%d]",
> >>> +			kdev_major(info->s_dev),  kdev_minor(info->s_dev));
> >>> +
> >>> +	if (info->fstype->code == FSTYPE__UNSUPPORTED) {
> >>
> >> Shouldn't this be FSTYE__AUTO instead?
> > 
> > No. It's FSTYPE__UNSUPPORTED at this moment.
> 
> Hm... Why?

Because for example we don't set ext4 as --enable-fd. Here we set
FSTYE__AUTO if a device of this mount is marked as external.

val = external_lookup_by_key(devstr);
if (val) {
...
	info->fstype = &fstypes[1];
	BUG_ON(info->fstype->code != FSTYPE__AUTO);
	xfree(info->source);
	info->source = source;
	return 0;





More information about the CRIU mailing list