On 6/15/18 3:44 AM, Kirill Tkhai wrote: > Hm, but is this a likely case, when real device is moved to net ns, so it > requires moving to init_net back? It seems the most devices moved to !init_net > are virtual and they just destroyed in default_device_exit_batch(). Or we have > more devices to care here? > > I don't much want to insert here something like below: > > if (__dev_get_by_name(&init_net, dev->name)) > snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); > err = dev_change_net_namespace(dev, &init_net, "dev%d"); > > because dev_change_net_namespace() is generic interface and it's used not > only here, > and this will crumble the code in corner cases. > > Maybe you have better ideas about this?
There are a lot of use cases these days (e.g., switch NOS) with 1000's (10's of 1000's) of netdevices. On top of that support for port netdevs in a namespace to create virtual switches needs to happen (and I suspect will happen in the next few years). That becomes one example where netdevices representing physical ports can be pushed back to init_net. That said, not many easy options at the moment for the bug you are fixing. Further, panic'ing a node because the move back to init_net fails is just wrong.