[CRIU] [PATCHv0 01/12] mount: save fs root fd of ps tree root mnt ns in its ns_id
Eugene Batalov
eabatalov89 at gmail.com
Sun Jul 24 11:58:03 PDT 2016
New criu gc command needs to access files in every ps tree ns.
It will use ns_id.mnt.root_fd for this.
ps tree processes shouldn't be created during criu gc so we can't
use /proc/$ns_pid/root based schema used in criu restore command.
Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com>
---
criu/mount.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/criu/mount.c b/criu/mount.c
index 7c280c0..5566c4f 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -3160,8 +3160,7 @@ void fini_restore_mntns(void)
if (nsid->nd != &mnt_ns_desc)
continue;
close_safe(&nsid->mnt.ns_fd);
- if (nsid->type != NS_ROOT)
- close_safe(&nsid->mnt.root_fd);
+ close_safe(&nsid->mnt.root_fd);
nsid->ns_populated = true;
}
}
@@ -3487,6 +3486,10 @@ ns_created:
nsid->mnt.ns_fd = open_proc(PROC_SELF, "ns/mnt");
if (nsid->mnt.ns_fd < 0)
goto err;
+ /* root_fd is used to restore file mappings */
+ nsid->mnt.root_fd = open_proc(PROC_SELF, "root");
+ if (nsid->mnt.root_fd < 0)
+ goto err;
/* we set ns_populated so we don't need to open root_fd */
nsid->ns_populated = true;
continue;
--
1.9.1
More information about the CRIU
mailing list