Commit 4497ac8e authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

mount: handle tracefs more gracefully

See the comment for details, but basically tracefs is automounted by the
kernel, so we can just mount debugfs with MS_REC and get the right result.

v2: rebase on criu-dev
v3: don't use a new fstype->flags, just always set MS_REC in debugfs'
    ->parse
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 4998d1ce
...@@ -1678,6 +1678,22 @@ out: ...@@ -1678,6 +1678,22 @@ out:
return ret; return ret;
} }
static int debugfs_parse(struct mount_info *pm)
{
/* tracefs is automounted underneath debugfs sometimes, and the
* kernel's overmounting protection prevents us from mounting debugfs
* first without tracefs, so let's always mount debugfs MS_REC.
*/
pm->flags |= MS_REC;
return 0;
}
static int tracefs_parse(struct mount_info *pm)
{
return 1;
}
static int cgroup_parse(struct mount_info *pm) static int cgroup_parse(struct mount_info *pm)
{ {
if (!(root_ns_mask & CLONE_NEWCGROUP)) if (!(root_ns_mask & CLONE_NEWCGROUP))
...@@ -1779,6 +1795,11 @@ static struct fstype fstypes[] = { ...@@ -1779,6 +1795,11 @@ static struct fstype fstypes[] = {
}, { }, {
.name = "debugfs", .name = "debugfs",
.code = FSTYPE__DEBUGFS, .code = FSTYPE__DEBUGFS,
.parse = debugfs_parse,
}, {
.name = "tracefs",
.code = FSTYPE__TRACEFS,
.parse = tracefs_parse,
}, { }, {
.name = "cgroup", .name = "cgroup",
.code = FSTYPE__CGROUP, .code = FSTYPE__CGROUP,
......
...@@ -1387,13 +1387,22 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) ...@@ -1387,13 +1387,22 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump)
if (new->fstype->parse) { if (new->fstype->parse) {
ret = new->fstype->parse(new); ret = new->fstype->parse(new);
if (ret) { if (ret < 0) {
pr_err("Failed to parse FS specific data on %s\n", pr_err("Failed to parse FS specific data on %s\n",
new->mountpoint); new->mountpoint);
mnt_entry_free(new); mnt_entry_free(new);
new = NULL; new = NULL;
goto end; goto end;
} }
if (ret > 0) {
pr_info("\tskipping fs mounted at %s\n", new->mountpoint + 1);
mnt_entry_free(new);
new = NULL;
ret = 0;
goto end;
}
} }
end: end:
if (fsname) if (fsname)
......
...@@ -19,6 +19,8 @@ enum fstype { ...@@ -19,6 +19,8 @@ enum fstype {
FUSE = 15; FUSE = 15;
AUTO = 16; AUTO = 16;
OVERLAYFS = 17; OVERLAYFS = 17;
// AUTOFS = 18; RESERVED in criu-dev branch
TRACEFS = 19;
}; };
message mnt_entry { message mnt_entry {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment