Message ID | 20c9e3a6-d8b7-fa3e-a655-b817ca9dc3b4@virtuozzo.com |
---|---|
State | Rejected |
Series | "net: set the root net ns after restoring all namespaces" |
Headers | show |
diff --git a/criu/net.c b/criu/net.c index e06d32bc..f9d4626f 100644 --- a/criu/net.c +++ b/criu/net.c @@ -2091,14 +2091,11 @@ static int create_net_ns(void *arg) exit(ret); } -int prepare_net_namespaces() +static int __prepare_net_namespaces(void *unused) { struct ns_id *nsid; int ret = -1; - if (!(root_ns_mask & CLONE_NEWNET)) - return 0; - for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { if (nsid->nd != &net_ns_desc) continue; @@ -2155,6 +2152,15 @@ int prepare_net_namespaces() return ret; } + +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;
On Wed, Mar 29, 2017 at 01:25:48PM +0300, Kirill Tkhai wrote: > On 29.03.2017 12:38, Kirill Tkhai wrote: > > On 28.03.2017 22:56, Andrei Vagin wrote: > >> From: Andrei Vagin <avagin@virtuozzo.com> > >> > >> Then we will create transport sockets and we want to know where > >> they will be created. > >> > >> Cc: Kirill Tkhai <ktkhai@virtuozzo.com> > >> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com> > > > > Looks good for me. Thanks. > > > > Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com> > > > > Though, the issue with tun still remains. The patch below for reproduction > > Andrew, I tried to move my patch set on this patch. It is moved not good: > we get new rule of order of generation of net namespaces and creation of > transport socket in usernsd. It would be more clear for further code writing > if we stay in criu net. Maybe we stay there? I suggest to call the whole > prepare_net_namespaces() functionality in separate function like here: It looks ok for me. Could you prepare a patch? > > diff --git a/criu/net.c b/criu/net.c > index e06d32bc..f9d4626f 100644 > --- a/criu/net.c > +++ b/criu/net.c > @@ -2091,14 +2091,11 @@ static int create_net_ns(void *arg) > exit(ret); > } > > -int prepare_net_namespaces() > +static int __prepare_net_namespaces(void *unused) > { > struct ns_id *nsid; > int ret = -1; > > - if (!(root_ns_mask & CLONE_NEWNET)) > - return 0; > - > for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { > if (nsid->nd != &net_ns_desc) > continue; > @@ -2155,6 +2152,15 @@ int prepare_net_namespaces() > return ret; > } > > + > +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;
On 22.04.2017 04:11, Andrei Vagin wrote: > On Wed, Mar 29, 2017 at 01:25:48PM +0300, Kirill Tkhai wrote: >> On 29.03.2017 12:38, Kirill Tkhai wrote: >>> On 28.03.2017 22:56, Andrei Vagin wrote: >>>> From: Andrei Vagin <avagin@virtuozzo.com> >>>> >>>> Then we will create transport sockets and we want to know where >>>> they will be created. >>>> >>>> Cc: Kirill Tkhai <ktkhai@virtuozzo.com> >>>> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com> >>> >>> Looks good for me. Thanks. >>> >>> Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com> >>> >>> Though, the issue with tun still remains. The patch below for reproduction >> >> Andrew, I tried to move my patch set on this patch. It is moved not good: >> we get new rule of order of generation of net namespaces and creation of >> transport socket in usernsd. It would be more clear for further code writing >> if we stay in criu net. Maybe we stay there? I suggest to call the whole >> prepare_net_namespaces() functionality in separate function like here: > > It looks ok for me. Could you prepare a patch? It's patch "[PATCH v3 01/55] ns: Do not change net_ns in prepare_net_namespaces()" from nested pid namespaces series.