[CRIU] [PATCH] restore: call close_old_fds() after mounting /proc

Andrey Vagin avagin at openvz.org
Fri Apr 11 04:21:29 PDT 2014


A process can be restored in a new pidns. close_old_fds() opens
the /proc/PID directory. Without this patch we can see errors like this:
(00.333915)      1: Error (util.c:102): Unable to close fd 6: Bad file descriptor

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-restore.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 6a9c4e5..d9d884e 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1246,9 +1246,6 @@ static int restore_task_with_children(void *_arg)
 		if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
 			exit(1);
 
-		if (close_old_fds(current))
-			exit(1);
-
 		if (collect_mount_info(getpid()))
 			exit(1);
 
@@ -1263,6 +1260,9 @@ static int restore_task_with_children(void *_arg)
 		if (mount_proc())
 			goto err;
 
+		if (close_old_fds(current))
+			exit(1);
+
 		if (root_prepare_shared())
 			goto err;
 	}
-- 
1.8.5.3



More information about the CRIU mailing list