Commit 5ec8a1c3 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

cr-restore: unlock connections at the last moment

Restore must not fail after unlocking connections.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 772d6853
......@@ -890,6 +890,18 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
futex_wait_while_gt(&task_entries->nr_in_progress, 0);
ret = (int)futex_get(&task_entries->nr_in_progress);
futex_set_and_wake(&task_entries->nr_in_progress, task_entries->nr);
futex_set_and_wake(&task_entries->start, CR_STATE_RESTORE_SIGCHLD);
futex_wait_until(&task_entries->nr_in_progress, 0);
/* Restore SIGCHLD here to skip SIGCHLD from a network sctip */
ret = sigaction(SIGCHLD, &old_act, NULL);
if (ret < 0) {
pr_perror("sigaction() failed\n");
goto out;
}
network_unlock();
out:
if (ret < 0) {
struct pstree_item *pi;
......@@ -907,18 +919,6 @@ out:
return 1;
}
futex_set_and_wake(&task_entries->nr_in_progress, task_entries->nr);
futex_set_and_wake(&task_entries->start, CR_STATE_RESTORE_SIGCHLD);
futex_wait_until(&task_entries->nr_in_progress, 0);
ret = sigaction(SIGCHLD, &old_act, NULL);
if (ret < 0) {
pr_perror("sigaction() failed\n");
return -1;
}
tcp_unlock_connections();
pr_info("Go on!!!\n");
futex_set_and_wake(&task_entries->start, CR_STATE_COMPLETE);
......
......@@ -424,6 +424,7 @@ void network_unlock(void)
if (!(opts.namespaces_flags & CLONE_NEWNET)) {
tcp_unlock_all();
tcp_unlock_connections();
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment