[CRIU] [PATCH v5 3/5] mount: Autodetect binfmt_misc

Kirill Tkhai ktkhai at virtuozzo.com
Thu Aug 4 06:49:18 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 f6de39e..39670c8 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -104,6 +104,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 c5533de..43ea96b 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1273,6 +1273,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);
@@ -1683,6 +1691,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,
@@ -3030,6 +3039,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