[CRIU] [PATCH 2/6] mount: save local mount point paths on restore
Andrey Vagin
avagin at openvz.org
Tue Aug 5 06:20:25 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.
v2: replace the offset field on a char * field
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..5df24d6 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.
+ * ns_mountpoint contains path w/o the termporary root.
*/
char *mountpoint;
+ char *ns_mountpoint;
unsigned flags;
int master_id;
int shared_id;
diff --git a/mount.c b/mount.c
index 1f12434..24cbfe9 100644
--- a/mount.c
+++ b/mount.c
@@ -1670,6 +1670,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->ns_mountpoint = pm->mountpoint + 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