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

Submitted by Kirill Tkhai on May 4, 2017, 4:11 p.m.

Details

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

Commit Message

Kirill Tkhai May 4, 2017, 4:11 p.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 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);
 
 	/*