[CRIU] [PATCH v4 3/5] mount: save ext_real_root for external mounts

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Mar 21 01:32:14 PDT 2017


need it to check if we can bindmount from external mount

https://jira.sw.ru/browse/PSBM-46753

v2: s/real_root/ext_real_root/
v4: add comment
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 criu/mount.c     | 3 ++-
 images/mnt.proto | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/criu/mount.c b/criu/mount.c
index 6e5a4c6..ef5c1ec 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1335,6 +1335,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img)
 		 * for reverse mapping details.
 		 */
 		me.root	= pm->external;
+		me.ext_real_root = pm->root;
 		me.has_ext_mount = true;
 		me.ext_mount = true;
 	} else
@@ -2445,7 +2446,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi)
 {
 	char *ext = NULL;
 
-	mi->root = xstrdup(me->root);
+	mi->root = xstrdup(me->ext_real_root ? : me->root);
 	if (!mi->root)
 		return -1;
 
diff --git a/images/mnt.proto b/images/mnt.proto
index 50cd8af..de516ff 100644
--- a/images/mnt.proto
+++ b/images/mnt.proto
@@ -53,4 +53,6 @@ message mnt_entry {
 
 	optional bool		deleted			= 16;
 	optional uint32		sb_flags		= 17 [(criu).hex = true];
+	/* when root path is overwriten by external mount id we put real root here */
+	optional string		ext_real_root		= 18;
 }
-- 
2.9.3



More information about the CRIU mailing list