mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 05:18:00 +00:00
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: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
3957a9a69a
commit
772d6853d2
26
cr-restore.c
26
cr-restore.c
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user