dump/restore fstype->name if FSTYPE__AUTO

Add the new mnt_entry->fsname member and change dump_one_mountpoint()
to save pm->fstype->name if fstype == FSTYPE__AUTO.

Change collect_mnt_from_image() to pass this ->fsname to decode_fstype()
which falls back to __find_fstype_by_name(fsname, true) if FSTYPE__AUTO.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Oleg Nesterov 2015-04-09 19:46:35 +02:00 committed by Pavel Emelyanov
parent 039cf95d59
commit eaf3a03ced
2 changed files with 10 additions and 2 deletions

10
mount.c
View file

@ -1230,10 +1230,13 @@ struct fstype *find_fstype_by_name(char *fst)
return __find_fstype_by_name(fst, false);
}
static struct fstype *decode_fstype(u32 fst)
static struct fstype *decode_fstype(u32 fst, char *fsname)
{
int i;
if (fst == FSTYPE__AUTO)
return __find_fstype_by_name(fsname, true);
if (fst == FSTYPE__UNSUPPORTED)
goto uns;
@ -1259,6 +1262,9 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img)
me.fstype = pm->fstype->code;
if (me.fstype == FSTYPE__AUTO)
me.fsname = pm->fstype->name;
if (pm->parent && !pm->dumped && !pm->need_plugin &&
pm->fstype->dump && fsroot_mounted(pm)) {
struct mount_info *t;
@ -1981,7 +1987,7 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
pm->is_ns_root = is_root(me->mountpoint);
/* FIXME: abort unsupported early */
pm->fstype = decode_fstype(me->fstype);
pm->fstype = decode_fstype(me->fstype, me->fsname);
if (me->ext_mount) {
struct ext_mount *em;

View file

@ -37,4 +37,6 @@ message mnt_entry {
optional bool with_plugin = 12;
optional bool ext_mount = 13;
optional string fsname = 14;
}