[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k3qz6w8x.fsf@xmission.com>
Date: Sat, 26 Jan 2013 21:16:46 -0800
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Cong Wang <amwang@...hat.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Subject: Re: [Patch net-next 2/2] netpoll: use the net namespace of current process instead of init_net
Cong Wang <amwang@...hat.com> writes:
> On Wed, 2013-01-23 at 17:02 +0800, Cong Wang wrote:
>> From: Cong Wang <amwang@...hat.com>
>>
>> This will allow us to setup netconsole in a different namespace
>> rather than where init_net is.
>>
>
> Hmm, I missed to put the netns in netpoll_cleanup()...
>
> Will send v2.
Since you are working on it. I forgot to mention that it doesn't
look you were working with nsproxy properly. The code just felt
very different from every other nsproxy reference I have seen.
Looking more closely since you are looking at current you don't need
to test to see if nsproxy is NULL. You can just say.
- if (np->dev_name)
- ndev = __dev_get_by_name(&init_net, np->dev_name);
+ if (np->dev_name) {
+ net = current->nsproxy->net_ns;
+ ndev = __dev_get_by_name(net, np->dev_name);
+ }
task_nsproxy and get_net are needed when you are accessing another
tasks nsproxy. Since you are just accessing current the code
can be much simpler.
Which also means that you shouldn't need to get a reference to
the network namespace or put the reference to the network namespace.
Although you do need to handle things like network device hotplug
in case the network device (or equivalently for most purposes) the
network namespace goes away.
Eric
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists