[CRIU] [PATCH 3/6] mnt: add --enable-external-sharing flag
Tycho Andersen
tycho.andersen at canonical.com
Tue Apr 7 16:37:18 PDT 2015
With this flag, external shared bind mounts are attempted to be resolved
automatically.
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
crtools.c | 6 ++++++
include/cr_options.h | 1 +
mount.c | 3 +++
3 files changed, 10 insertions(+)
diff --git a/crtools.c b/crtools.c
index a6ee2d7..fe77f39 100644
--- a/crtools.c
+++ b/crtools.c
@@ -204,6 +204,7 @@ int main(int argc, char *argv[], char *envp[])
{ "inherit-fd", required_argument, 0, 1062 },
{ "feature", required_argument, 0, 1063 },
{ "skip-mnt", required_argument, 0, 1064},
+ { "enable-external-sharing", no_argument, 0, 1065 },
{ },
};
@@ -421,6 +422,9 @@ int main(int argc, char *argv[], char *envp[])
if (!add_skip_mount(optarg))
return 1;
break;
+ case 1065:
+ opts.enable_external_sharing = true;
+ break;
case 'M':
{
char *aux;
@@ -649,6 +653,8 @@ usage:
" add external mount mapping\n"
" -M|--ext-mount-map auto\n"
" attempt to autodetect external mount mapings\n"
+" --enable-external-sharing\n"
+" allow autoresolving mounts with external sharing\n"
" --manage-cgroups dump or restore cgroups the process is in\n"
" --cgroup-root [controller:]/newroot\n"
" change the root cgroup the controller will be\n"
diff --git a/include/cr_options.h b/include/cr_options.h
index f1cfc84..29be2c8 100644
--- a/include/cr_options.h
+++ b/include/cr_options.h
@@ -63,6 +63,7 @@ struct cr_options {
char *new_global_cg_root;
struct list_head new_cgroup_roots;
bool autodetect_ext_mounts;
+ bool enable_external_sharing;
bool aufs; /* auto-deteced, not via cli */
};
diff --git a/mount.c b/mount.c
index 49a07dd..8835a81 100644
--- a/mount.c
+++ b/mount.c
@@ -688,6 +688,9 @@ static int resolve_external_mounts(struct mount_info *info)
if (mounts_equal(pm, m, true))
match = true;
+ if (opts.enable_external_sharing && pm->shared_id == m->shared_id)
+ match = true;
+
if (!match)
continue;
--
2.1.4
More information about the CRIU
mailing list