From: Cong Wang <amwang@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next 2/2] netpoll: use the net namespace of current process instead of init_net
Date: Mon, 28 Jan 2013 09:36:00 +0800 [thread overview]
Message-ID: <1359336960.20444.7.camel@cr0> (raw)
In-Reply-To: <87k3qz6w8x.fsf@xmission.com>
On Sat, 2013-01-26 at 21:16 -0800, Eric W. Biederman wrote:
> Cong Wang <amwang@redhat.com> writes:
>
> > On Wed, 2013-01-23 at 17:02 +0800, Cong Wang wrote:
> >> From: Cong Wang <amwang@redhat.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.
Ok.
>
> 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.
I believe we already handle NETDEV_UNREGISTER.
Thanks!
prev parent reply other threads:[~2013-01-28 1:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 9:02 [Patch net-next 1/2] netpoll: use ipv6_addr_equal() to compare ipv6 addr Cong Wang
2013-01-23 9:02 ` [Patch net-next 2/2] netpoll: use the net namespace of current process instead of init_net Cong Wang
2013-01-26 10:00 ` Cong Wang
2013-01-27 5:16 ` Eric W. Biederman
2013-01-28 1:36 ` Cong Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359336960.20444.7.camel@cr0 \
--to=amwang@redhat.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).