2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 22:35:33 +00:00

introduce --enable-fs cli option

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@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Oleg Nesterov
2015-04-09 19:46:38 +02:00
committed by Pavel Emelyanov
parent eaf3a03ced
commit e2c38245c6
3 changed files with 32 additions and 1 deletions

View File

@@ -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"

View File

@@ -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);

24
mount.c
View File

@@ -1172,9 +1172,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)