[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wpnur4a4.fsf@x220.int.ebiederm.org>
Date: Mon, 18 Apr 2016 16:33:07 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Francesco Ruggeri <fruggeri@...sta.com>
Cc: netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Mahesh Bandewar <maheshb@...gle.com>
Subject: Re: [PATCH net-next] macvlan: fix failure during registration
Francesco Ruggeri <fruggeri@...sta.com> writes:
> On Mon, Apr 18, 2016 at 11:48 AM, Eric W. Biederman
> <ebiederm@...ssion.com> 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;
>
The code I have looks a little different. But that is a good point.
But please see if you can get macvlan_init to do the necessary work.
That should simplify everything, and make clever games unnecessary.
Eric
Powered by blists - more mailing lists