Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Vagin <avagin@openvz.org>2014-09-12 15:41:00 +0400
committerPavel Emelyanov <xemul@parallels.com>2014-09-22 12:22:03 +0400
commit5050c3bbfa04cd3599375382efa73f319d6da0a2 (patch)
tree3577d8c21288e32a807eef80532bec9f984aee93
parentc948c8bc3a3f1d645afb4ec43ac544138bd29fe4 (diff)
mount: handle a circular reference in mount tree
$ cat /proc/self/mountinfo ... 1 1 0:2 / / rw - rootfs rootfs rw,size=373396k,nr_inodes=93349 ... You can see that mnt_id and parent_mnt_id are equals here. This patch interpretes this case as a root mount in a tree. 0'th mount is rootfs, which is mounted in init_mount_tree(). We don't see it in cases when system makes chroot, because of static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt) ... /* mountpoints outside of chroot jail will give SEQ_SKIP on this */ err = seq_path_root(m, &mnt_path, &root, " \t\n\\"); Cc: beproject criu <beprojectcriu@gmail.com> Cc: Christopher Covington <cov@codeaurora.org> Reported-by: beproject criu <beprojectcriu@gmail.com> Reviewed-by: Christopher Covington <cov@codeaurora.org> Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
-rw-r--r--mount.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mount.c b/mount.c
index 3896a682f..92a98ef6e 100644
--- a/mount.c
+++ b/mount.c
@@ -251,7 +251,12 @@ static struct mount_info *mnt_build_ids_tree(struct mount_info *list)
struct mount_info *p;
pr_debug("\t\tWorking on %d->%d\n", m->mnt_id, m->parent_mnt_id);
- p = __lookup_mnt_id(list, m->parent_mnt_id);
+
+ if (m->mnt_id != m->parent_mnt_id)
+ p = __lookup_mnt_id(list, m->parent_mnt_id);
+ else /* a circular mount reference. It's rootfs or smth like it. */
+ p = NULL;
+
if (!p) {
/* This should be / */
if (root == NULL && is_root_mount(m)) {