On Mon, Apr 18, 2016 at 11:48 AM, Eric W. Biederman
<[email protected]> wrote:
>
> These interactions all seem a little bit funny. At a quick skim it
> would make more sense to increment the port count in macvlan_init,
> and completely remove the need to mess with port counts anywhere except
> macvlan_init and macvlan_uninit.
Thanks Eric, let me try that.
>
> If for some reason that can't be done the code can easily look at
> dev->reg_state. If dev->reg_state == NETREG_UNITIALIZED it should
> be exactly the same as your new flag being set.
>
I am not sure that in macvlan_uninit one can tell whether it is being
invoked in the context of a failed register_netdevice (if that is what
you meant).
In case of register_netdevice failing in
call_netdevice_notifiers(NETDEV_REGISTER) the call sequence is:
macvlan_common_newlink
register_netdevice
call_netdevice_notifiers(NETDEV_REGISTER, dev) (<== fail here)
rollback_registered(dev);
rollback_registered_many
dev->reg_state = NETREG_UNREGISTERING
dev->netdev_ops->ndo_uninit(dev)
dev->reg_state = NETREG_UNREGISTERED;
Francesco