mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
mount: Config-out virtualized binfmt_misc
The need to mess with binfmt_misc super-blocks only exists in OpenVZ kernel and troubes all the other users. So make this code get compiled-out by default. In VZ-builds the BINFMT_MISC_VIRTUALIZED should be put into .config file before running make. https://github.com/xemul/criu/issues/235 travis-ci: success for Don't compile in binfmt_misc dumping code by default (rev3) Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Reviewed-by: Dmirty Safonov <dsafonov@virtuozzo.com>
This commit is contained in:
@@ -30,6 +30,7 @@ static int attach_option(struct mount_info *pm, char *opt)
|
||||
return pm->options ? 0 : -1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED
|
||||
struct binfmt_misc_info {
|
||||
BinfmtMiscEntry *bme;
|
||||
struct list_head list;
|
||||
@@ -370,6 +371,11 @@ int collect_binfmt_misc(void)
|
||||
{
|
||||
return collect_image(&binfmt_misc_cinfo);
|
||||
}
|
||||
#else
|
||||
#define binfmt_misc_dump NULL
|
||||
#define binfmt_misc_restore NULL
|
||||
#define binfmt_misc_parse NULL
|
||||
#endif
|
||||
|
||||
static int tmpfs_dump(struct mount_info *pm)
|
||||
{
|
||||
|
@@ -96,7 +96,9 @@ struct cr_options {
|
||||
bool enable_external_masters;
|
||||
bool aufs; /* auto-deteced, not via cli */
|
||||
bool overlayfs;
|
||||
#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED
|
||||
bool has_binfmt_misc; /* auto-detected */
|
||||
#endif
|
||||
size_t ghost_limit;
|
||||
struct list_head irmap_scan_paths;
|
||||
bool lsm_supplied;
|
||||
|
@@ -71,7 +71,11 @@ struct mount_info {
|
||||
|
||||
extern struct mount_info *mntinfo;
|
||||
extern struct ns_desc mnt_ns_desc;
|
||||
#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED
|
||||
extern int collect_binfmt_misc(void);
|
||||
#else
|
||||
static inline int collect_binfmt_misc(void) { return 0; }
|
||||
#endif
|
||||
|
||||
extern struct mount_info *mnt_entry_alloc();
|
||||
extern void mnt_entry_free(struct mount_info *mi);
|
||||
|
10
criu/mount.c
10
criu/mount.c
@@ -1138,7 +1138,7 @@ out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev)
|
||||
static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev)
|
||||
{
|
||||
struct mount_info *mi, *t, *parent;
|
||||
|
||||
@@ -1186,7 +1186,7 @@ static int add_cr_time_mount(struct mount_info *root, char *fsname, const char *
|
||||
}
|
||||
|
||||
/* Returns 1 in case of success, -errno in case of mount fail, and 0 on other errors */
|
||||
static int mount_cr_time_mount(struct ns_id *ns, unsigned int *s_dev, const char *source,
|
||||
static __maybe_unused int mount_cr_time_mount(struct ns_id *ns, unsigned int *s_dev, const char *source,
|
||||
const char *target, const char *type)
|
||||
{
|
||||
int mnt_fd, ret, exit_code = 0;
|
||||
@@ -2453,8 +2453,10 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED
|
||||
if (me->fstype == FSTYPE__BINFMT_MISC)
|
||||
opts.has_binfmt_misc = true;
|
||||
#endif
|
||||
|
||||
/* FIXME: abort unsupported early */
|
||||
pm->fstype = decode_fstype(me->fstype);
|
||||
@@ -2665,12 +2667,14 @@ static int populate_mnt_ns(void)
|
||||
if (!pms)
|
||||
return -1;
|
||||
|
||||
#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED
|
||||
if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) {
|
||||
/* Add to mount tree. Generic code will mount it later */
|
||||
ret = add_cr_time_mount(pms, "binfmt_misc", BINFMT_MISC_HOME, 0);
|
||||
if (ret)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (resolve_shared_mounts(mntinfo, pms->master_id))
|
||||
return -1;
|
||||
@@ -3126,6 +3130,7 @@ int collect_mnt_namespaces(bool for_dump)
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED
|
||||
if (for_dump && !opts.has_binfmt_misc) {
|
||||
unsigned int s_dev = 0;
|
||||
struct ns_id *ns;
|
||||
@@ -3153,6 +3158,7 @@ int collect_mnt_namespaces(bool for_dump)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = resolve_external_mounts(mntinfo);
|
||||
if (ret)
|
||||
|
Reference in New Issue
Block a user