[CRIU] [PATCH] mount: dump a file system only if a mount point isn't overmounted

Andrey Vagin avagin at openvz.org
Thu May 5 12:12:14 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

Something else may be mounted into the same folder and in this case
we can't get access to the required file system.

$ cat /proc/61693/root/etc/redhat-release
Fedora release 23 (Twenty Three)

$ cat /proc/61692/mountinfo  | grep '\s/tmp'
234 199 0:57 / /tmp rw shared:97 master:76 - tmpfs tmpfs rw,size=131072k,nr_inodes=32768
235 234 0:57 /systemd-private-dd74de99e1104383aa7cd6e27d3d0b8a-httpd.service-uFqNHk/tmp /tmp rw,relatime shared:98 master:76 - tmpfs tmpfs rw,size=131072k,nr_inodes=32768

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/mount.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/criu/mount.c b/criu/mount.c
index 431341e..19e8a11 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1875,6 +1875,8 @@ uns:
 static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img)
 {
 	MntEntry me = MNT_ENTRY__INIT;
+	bool overmounted = false;
+	struct mount_info *c;
 
 	pr_info("\t%d: %x:%s @ %s\n", pm->mnt_id, pm->s_dev,
 			pm->root, pm->mountpoint);
@@ -1884,8 +1886,12 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img)
 	if (me.fstype == FSTYPE__AUTO)
 		me.fsname = pm->fstype->name;
 
+	list_for_each_entry(c, &pm->children, siblings)
+		if (strcmp(pm->mountpoint, c->mountpoint) == 0)
+			overmounted = true;
+
 	if (pm->parent && !pm->dumped && !pm->need_plugin && !pm->external &&
-	    pm->fstype->dump && fsroot_mounted(pm)) {
+	    pm->fstype->dump && fsroot_mounted(pm) && !overmounted) {
 		struct mount_info *t;
 
 		if (pm->fstype->dump(pm))
-- 
2.7.4



More information about the CRIU mailing list