[CRIU] [PATCH v2 5/5] introduce --enable-fs cli option
Oleg Nesterov
oleg at redhat.com
Thu Apr 9 10:46:38 PDT 2015
Finally add --enable-fs option to specify the comma separated list of
filesystem names which should be treated as FSTYPE_AUTO.
Note: obviously this option is not safe, use at your own risk. "dump"
will always succeed if the mntpoint is auto, but "restore" can fail or
do something wrong if mount(src, mountpoint, flags, options) can not
actually "just work" as FSTYPE_AUTO logic expects.
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
crtools.c | 8 ++++++++
include/mount.h | 1 +
mount.c | 24 +++++++++++++++++++++++-
3 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/crtools.c b/crtools.c
index 9a0902d..8dfce4d 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-fs", required_argument, 0, 1065},
{ },
};
@@ -421,6 +422,10 @@ int main(int argc, char *argv[], char *envp[])
if (!add_skip_mount(optarg))
return 1;
break;
+ case 1065:
+ if (!add_fsname_auto(optarg))
+ return 1;
+ break;
case 'M':
{
char *aux;
@@ -648,6 +653,9 @@ usage:
" installed into. No controller means that root is the\n"
" default for all controllers not specified.\n"
" --skip-mnt PATH ignore this mountpoint when dumping the mount namespace.\n"
+" --enable-fs FSNAMES a comma separated list of filesystem names or \"all\".\n"
+" force criu to (try to) dump/restore these filesystem's\n"
+" mountpoints even if fs is not supported.\n"
"\n"
"* Logging:\n"
" -o|--log-file FILE log file name\n"
diff --git a/include/mount.h b/include/mount.h
index 75721b5..0d5fc7f 100644
--- a/include/mount.h
+++ b/include/mount.h
@@ -13,6 +13,7 @@ struct proc_mountinfo;
extern int open_mount(unsigned int s_dev);
extern struct fstype *find_fstype_by_name(char *fst);
+extern bool add_fsname_auto(const char *names);
struct cr_imgset;
extern struct mount_info * collect_mntinfo(struct ns_id *ns, bool for_dump);
diff --git a/mount.c b/mount.c
index 8bab184..eb739f2 100644
--- a/mount.c
+++ b/mount.c
@@ -1117,9 +1117,31 @@ static struct fstype fstypes[32] = {
},
};
+static char *fsauto_names;
+
static bool fsname_is_auto(const char *name)
{
- return false;
+ const char *p;
+
+ if (!fsauto_names)
+ return false;
+
+ if (strcmp(fsauto_names, "all") == 0)
+ return true;
+
+ for (p = strtok(fsauto_names, ","); p; p = strtok(NULL, ",")) {
+ if (strcmp(name, p) == 0)
+ return true;
+ }
+
+ return false;
+}
+
+bool add_fsname_auto(const char *names)
+{
+ xfree(fsauto_names);
+ fsauto_names = xstrdup(names);
+ return fsauto_names != NULL;
}
static struct fstype *__find_fstype_by_name(char *fst, bool force_auto)
--
1.5.5.1
More information about the CRIU
mailing list