mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-03 23:33:01 +00:00
ns: Do not change net_ns in prepare_net_namespaces()
In next patches usernsd will need to create transport socket in the same net_ns as other tasks do their TRANSPORT_FD_OFF sockets. Choose criu net_ns for that: this allows usernsd to do not wait for creation of other net_ns, i.e. to do not introduce new dependencies between tasks. In case of (root_ns_mask & CLONE_NEWUSER) != 0 root_item's user_ns does not allow to restore criu net_ns, so do prepare_net_namespaces() in sub-process to do not lose criu net. v3: Introduce __prepare_net_namespaces and execute it in cloned task. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
453a90e580
commit
b5225915df
2 changed files with 11 additions and 5 deletions
14
criu/net.c
14
criu/net.c
|
|
@ -2301,13 +2301,10 @@ static int do_create_net_ns(struct ns_id *ns)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int prepare_net_namespaces()
|
||||
static int __prepare_net_namespaces(void *unused)
|
||||
{
|
||||
struct ns_id *nsid;
|
||||
|
||||
if (!(root_ns_mask & CLONE_NEWNET))
|
||||
return 0;
|
||||
|
||||
for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
|
||||
if (nsid->nd != &net_ns_desc)
|
||||
continue;
|
||||
|
|
@ -2357,6 +2354,15 @@ err:
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int prepare_net_namespaces(void)
|
||||
{
|
||||
if (!(root_ns_mask & CLONE_NEWNET))
|
||||
return 0;
|
||||
|
||||
return call_in_child_process(__prepare_net_namespaces, NULL);
|
||||
}
|
||||
|
||||
static int do_restore_task_net_ns(struct ns_id *nsid, struct pstree_item *current)
|
||||
{
|
||||
int fd;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{'flavor': 'ns uns', 'flags': 'suid', 'feature': 'tun'}
|
||||
{'flavor': 'ns uns', 'flags': 'suid noauto', 'feature': 'tun'}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue