[CRIU] [PATCH v6 5/7] mount: Autodetect binfmt_misc

Kirill Tkhai ktkhai at virtuozzo.com
Tue Aug 23 09:16:59 PDT 2016


Set opts bit if binfmt_misc is mounted on root mnt_ns

v5: New
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/include/cr_options.h |    1 +
 criu/mount.c              |   12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index 35748de..ba5c23f 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -103,6 +103,7 @@ struct cr_options {
 	bool			enable_external_masters;
 	bool			aufs;		/* auto-deteced, not via cli */
 	bool			overlayfs;
+	bool			has_binfmt_misc; /* auto-detected */
 	size_t			ghost_limit;
 	struct list_head	irmap_scan_paths;
 	bool			lsm_supplied;
diff --git a/criu/mount.c b/criu/mount.c
index 9b22eeb..6f94e3d 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1281,6 +1281,14 @@ static int devtmpfs_restore(struct mount_info *pm)
 	return ret;
 }
 
+static int binfmt_misc_parse(struct mount_info *pm)
+{
+	if (pm->nsid->type == NS_ROOT)
+		opts.has_binfmt_misc = true;
+	return 0;
+
+}
+
 static int binfmt_misc_virtual(struct mount_info *pm)
 {
 	return kerndat_fs_virtualized(KERNDAT_FS_STAT_BINFMT_MISC, pm->s_dev);
@@ -1718,6 +1726,7 @@ static struct fstype fstypes[] = {
 		.restore = devtmpfs_restore,
 	}, {
 		.name = "binfmt_misc",
+		.parse = binfmt_misc_parse,
 		.code = FSTYPE__BINFMT_MISC,
 		.dump = binfmt_misc_dump,
 		.restore = binfmt_misc_restore,
@@ -3072,6 +3081,9 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
 			goto err;
 		}
 
+		if (me->fstype == FSTYPE__BINFMT_MISC)
+			opts.has_binfmt_misc = true;
+
 		/* FIXME: abort unsupported early */
 		pm->fstype = decode_fstype(me->fstype);
 



More information about the CRIU mailing list