Subject: Re: [RFC PATCH net-next 00/11] netns: don't switch namespace while creating kernel sockets

From: [email-masked] (Eric W. Biederman)
Date: Thu, 07 May 2015 13:58:29 -0500

Cong Wang <[email-masked]> writes:

> On Thu, May 7, 2015 at 11:26 AM, Eric W. Biederman
> <[email-masked]> wrote:
>> Cong Wang <[email-masked]> writes:
>>
>>>
>>> Why does this have to be so complicated? We can simply avoid
>>> calling ops_init() by skipping those in cleanup_list, no?
>>
>> The problem is that there is a single list of methods to call and if you
>> simply skip calling the initialization methods for a struct net and add
>> yourself to the list cleanup_net will then call the cleanup methods
>> without calling the cleanup methods.
>
> If you mean pernet_list, ops->list has been already added before
> for_each_net().
>
>>
>> Simply limiting new network namespace registrations to a point when
>> network namespaces are not being registered or unregisted seems like
>> the simplest way to achieve this effect.
>>
>
> Literally, any point before ops_init().

Think about what that what it means to add a set of operations to the
pernet_list and then to skip a network namespace with a count of 0 and
then to have that network namespace exit with those methods on
pernet_list.

Eric