[CRIU] [PATCH v2 4/5] dump/restore fstype->name if FSTYPE__AUTO

Oleg Nesterov oleg at redhat.com
Thu Apr 9 10:46:35 PDT 2015


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 at redhat.com>
---
 mount.c            |   10 ++++++++--
 protobuf/mnt.proto |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/mount.c b/mount.c
index 59ccf6d..8bab184 100644
--- a/mount.c
+++ b/mount.c
@@ -1161,10 +1161,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;
 
@@ -1190,6 +1193,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;
@@ -1912,7 +1918,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;
diff --git a/protobuf/mnt.proto b/protobuf/mnt.proto
index 9bb920d..8afb976 100644
--- a/protobuf/mnt.proto
+++ b/protobuf/mnt.proto
@@ -36,4 +36,6 @@ message mnt_entry {
 
 	optional bool		with_plugin		= 12;
 	optional bool		ext_mount		= 13;
+
+	optional string		fsname			= 14;
 }
-- 
1.5.5.1



More information about the CRIU mailing list