[CRIU] [PATCH 3/4] cr-restore: close network socket before
restoring file descriptors
Adrian Reber
adrian at lisas.de
Wed Aug 15 05:54:28 EDT 2012
To make sure the network socket for migration does not conflict
with the file descriptors which will be restored the network
socket is closed and reopened.
Signed-off-by: Adrian Reber <adrian at lisas.de>
---
cr-restore.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index 65f698b..fe07599 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -286,6 +286,7 @@ static int restore_one_alive_task(int pid, CoreEntry *core)
if (prepare_fds(me))
return -1;
+ reopen_listen_socket();
if (prepare_fs(pid))
return -1;
@@ -425,6 +426,9 @@ static int restore_one_task(int pid)
int fd, ret;
CoreEntry *core;
+ /* try to reopen the network listen socket */
+ reopen_listen_socket();
+
if (me->state == TASK_HELPER)
return restore_one_fake(pid);
@@ -442,6 +446,7 @@ static int restore_one_task(int pid)
ret = -1;
goto out;
}
+ close_listen_socket();
switch ((int)core->tc->task_state) {
case TASK_ALIVE:
@@ -902,6 +907,12 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts)
if (prepare_pstree_ids() < 0)
return -1;
+ /*
+ * closing network listen socket to be able to restore all previously
+ * opened file desriptors.
+ */
+ close_listen_socket();
+
futex_set(&task_entries->nr_in_progress, task_entries->nr_tasks + task_entries->nr_helpers);
return restore_root_task(root_item, opts);
--
1.7.6.5
More information about the CRIU
mailing list