[v3,51/55] restorer: Close transport socket later

Submitted by Kirill Tkhai on April 10, 2017, 8:23 a.m.

Details

Message ID 149181261182.17342.3702934161935869476.stgit@localhost.localdomain
State New
Series "Nested pid namespaces support"
Headers show

Commit Message

Kirill Tkhai April 10, 2017, 8:23 a.m.
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@virtuozzo.com>
---
 criu/cr-restore.c       |    2 +-
 criu/include/restorer.h |    2 ++
 criu/pie/restorer.c     |    1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 05097ae23..2402f6402 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -3502,12 +3502,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 9a392a804..002912334 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 616141a08..67d5a0132 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);
 
 	/*