Commit 772d6853 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

crtools: collect inet sockets to crtools

Early we moved prepare_shared() to a root task,
because several preparation actions should be executed
in a target namespace set (e.g.: ghost files).

TCP sockets are a subset of init sockets,
they should be unlocked before resume. It's convient to do
from crtools.
An image can't be read more than one time, because we want to
send it via network.

For this two reasons prepare_shared is spitted in two parts,
one for crtools and one for a root task.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3957a9a6
......@@ -78,7 +78,19 @@ static int shmem_remap(void *old_addr, void *new_addr, unsigned long size)
return 0;
}
static int prepare_shared(void)
static int crtools_prepare_shared(void)
{
if (prepare_shared_fdinfo())
return -1;
/* Connections are unlocked from crtools */
if (collect_inet_sockets())
return -1;
return 0;
}
static int root_prepare_shared(void)
{
int ret = 0;
struct pstree_item *pi;
......@@ -88,13 +100,9 @@ static int prepare_shared(void)
if (prepare_shmem_restore())
return -1;
if (prepare_shared_fdinfo())
return -1;
if (prepare_shared_tty())
return -1;
if (collect_reg_files())
return -1;
......@@ -104,9 +112,6 @@ static int prepare_shared(void)
if (collect_fifo())
return -1;
if (collect_inet_sockets())
return -1;
if (collect_unix_sockets())
return -1;
......@@ -761,7 +766,7 @@ static int restore_task_with_children(void *_arg)
if (mount_proc())
exit(-1);
if (prepare_shared())
if (root_prepare_shared())
exit(-1);
}
......@@ -951,6 +956,9 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts)
if (prepare_pstree_ids() < 0)
return -1;
if (crtools_prepare_shared() < 0)
return -1;
futex_set(&task_entries->nr_in_progress, task_entries->nr_tasks + task_entries->nr_helpers);
return restore_root_task(root_item, opts);
......
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