[CRIU] [PATCH 05/11] mount: save local mount point paths on restore

Andrey Vagin avagin at openvz.org
Sun Aug 3 11:31:19 PDT 2014


On restore we add a temporary root to a mount point path. It's convinient
for restoring mount namespaces, but real paths are used for restoring
link-remap files.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 include/proc_parse.h | 4 ++++
 mount.c              | 1 +
 2 files changed, 5 insertions(+)

diff --git a/include/proc_parse.h b/include/proc_parse.h
index ff1ea5d..4c21055 100644
--- a/include/proc_parse.h
+++ b/include/proc_parse.h
@@ -110,8 +110,12 @@ struct mount_info {
 	 * mountpoint contains path with dot at the beginning.
 	 * It allows to use openat, statat, etc without creating
 	 * a temporary copy.
+	 * On restore mountpoint contains path with a termporary root,
+	 * if a mount is in non-root namespace.
+	 * mountpoint + rst_off contains path w/o the termporary root.
 	 */
 	char		*mountpoint;
+	int		rst_off;
 	unsigned	flags;
 	int		master_id;
 	int		shared_id;
diff --git a/mount.c b/mount.c
index d1f1f78..544a840 100644
--- a/mount.c
+++ b/mount.c
@@ -1678,6 +1678,7 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
 		pm->mountpoint = xmalloc(len);
 		if (!pm->mountpoint)
 			goto err;
+		pm->rst_off = root_len;
 		/*
 		 * For bind-mounts we would also fix the root here
 		 * too, but bind-mounts restore merges mountpoint
-- 
1.8.5.3



More information about the CRIU mailing list