[CRIU] [PATCH v4 37/41] restorer: Close transport socket later

Kirill Tkhai ktkhai at virtuozzo.com
Thu May 4 09:11:30 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 a3436209b..b240643f9 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -3576,12 +3576,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 65e0eb515..5b04d1f67 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 3b0b35710..6c96a9850 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -1559,6 +1559,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