[CRIU] [PATCH v2 53/57] restorer: Close transport socket later

Kirill Tkhai ktkhai at virtuozzo.com
Tue Mar 28 08:41:56 PDT 2017


We need a socket to request NStids for tasks threads.
Transport socket will be used for that in next patches.
So, close it later, after threads are created.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-restore.c       |    2 +-
 criu/include/restorer.h |    2 ++
 criu/pie/restorer.c     |    1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 24724d3b..e29a5bd9 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -3392,12 +3392,12 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns
 
 	close_image_dir();
 	close_proc();
-	close_service_fd(TRANSPORT_FD_OFF);
 	close_service_fd(CR_PROC_FD_OFF);
 	close_service_fd(ROOT_FD_OFF);
 	close_service_fd(USERNSD_SK);
 	close_service_fd(FDSTORE_SK_OFF);
 	close_service_fd(RPC_SK_OFF);
+	task_args->transport_fd = get_service_fd(TRANSPORT_FD_OFF);
 
 	__gcov_flush();
 
diff --git a/criu/include/restorer.h b/criu/include/restorer.h
index 9a392a80..00291233 100644
--- a/criu/include/restorer.h
+++ b/criu/include/restorer.h
@@ -175,6 +175,8 @@ struct task_restore_args {
 	 */
 	int				proc_fd;
 
+	int				transport_fd;
+
 	int				seccomp_mode;
 
 	bool				compatible_mode;
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 616141a0..67d5a013 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -1570,6 +1570,7 @@ long __export_restore_task(struct task_restore_args *args)
 	futex_wait_while_gt(&thread_inprogress, 1);
 
 	sys_close(args->proc_fd);
+	sys_close(args->transport_fd);
 	std_log_set_fd(-1);
 
 	/*



More information about the CRIU mailing list