[CRIU] [PATCH] mount: close mnt.ns_fd only for sub-namespaces (v3)

Andrey Vagin avagin at openvz.org
Thu Nov 26 11:35:27 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

nsid->mnt.ns_fd is initialized into 0, so currently
fini_restore_mntns() closes the 0 descriptor if processes
lives in a current mount namespace (NS_CRIU).

Without this patch I get the following error:
(00.166444)   4109: Inherit fd tty:[8800:d] -> 0 has been closed

v2: typo fix
v3: do nothing when processes are restored in the local mntns
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 mount.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mount.c b/mount.c
index 20ae79b..6ad8058 100644
--- a/mount.c
+++ b/mount.c
@@ -2650,6 +2650,9 @@ void fini_restore_mntns(void)
 {
 	struct ns_id *nsid;
 
+	if (!(root_ns_mask & CLONE_NEWNS))
+		return;
+
 	for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
 		if (nsid->nd != &mnt_ns_desc)
 			continue;
-- 
2.4.3



More information about the CRIU mailing list