On Wed, Feb 3, 2016 at 12:08 AM, Julian Anastasov <j...@ssi.bg> wrote:


>         Aha, I see, it is after NETDEV_UNREGISTER but may be
> the above loop should be changed to two loops so that
> NETDEV_UNREGISTER_BATCH is called exactly after all
> NETDEV_UNREGISTER and before all dev_*_flush and
> ndo_uninit calls to avoid any risks. I mean:
>
>         synchronize_net();
>
>         First part of loop:
>
>         list_for_each_entry(dev, head, unreg_list) {
>                 /* Shutdown queueing discipline. */
>                 dev_shutdown(dev);
>
>                 /* Notify protocols, that we are about to destroy
>                    this device. They should clean all the things.
>                 */
>                 call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
>         }
>
>         This is the same NETDEV_UNREGISTER_BATCH logic:
>
> +       list_for_each_entry(dev, head, unreg_list) {
> +               net_add_event_list(&net_head, dev_net(dev));
> +       }
> +       list_for_each_entry_safe(net, net_tmp, &net_head, event_list) {
> +               call_netdevice_notifiers(NETDEV_UNREGISTER_BATCH,
> +                                        net->loopback_dev);
> +               net_del_event_list(net);
> +       }
>
>         Second part of the loop:
>
>         list_for_each_entry(dev, head, unreg_list) {
>                 struct sk_buff *skb = NULL;
>
>                 if (!dev->rtnl_link_ops ||
>                 ...
>
> Regards
>
> --
> Julian Anastasov <j...@ssi.bg>

You're right. It is probably safer to organize the code the way you said.
Will change that, Thanks!

Salam

Reply via email to