netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [Patch net] netns: avoid allocating idr when dumping info
Date: Fri, 27 Feb 2015 22:17:27 -0800	[thread overview]
Message-ID: <CAM_iQpV7sVimr+3BzA8ZYW-wixwxv29r4jGZFB1FfUwCGN8QxA@mail.gmail.com> (raw)
In-Reply-To: <CAM_iQpUBp9bZGWTjq5UhFz4Z0Zt3YF-6cwkZafd54WP9cP8H+w@mail.gmail.com>

(Removing Eric from discussion since he expressed he doesn't
care this code at all in a private email.)


On Fri, Feb 27, 2015 at 4:56 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>
> Why? This relies on rtnetlink to dump the link after creation,
> which is not obvious at all. IOW, imagine if rtnetlink didn't do
> the dump after new link, what would happen?
>
> You are hiding it too deep, without a valid reason. It sounds
> like you want to defer the allocation as late as possible,
> but again it makes no sense: 1) we don't allocate too much,
> just one id in idr; 2) this loses the code readability and hides
> potential bugs.
>

Here we go:

This breaks veth, where veth peers are completely equal,
therefore they are links for each other. So we expect
link-netnsid shown on both side.

Your current impl. relies on rtnl_configure_link() to dump
the link to allocate the netns id after creating a link.
Unfortunately for veth, rtnl_configure_link() is called
before veth->peer is set, therefore the dump of the "peer"
does _not_ actually allocate the netns id, since its
->get_link_net() returns the same net.

I will send a patch together after I figure out another bug
I saw.

  reply	other threads:[~2015-02-28  6:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27  6:32 [Patch net] netns: avoid allocating idr when dumping info Cong Wang
2015-02-27  8:01 ` Eric Dumazet
2015-02-27 16:25   ` Nicolas Dichtel
2015-02-27 16:55     ` Eric Dumazet
2015-02-27 17:07     ` [PATCH] net: do not use rcu in rtnl_dump_ifinfo() Eric Dumazet
2015-02-27 17:19       ` Daniel Borkmann
2015-02-27 17:40         ` Eric Dumazet
2015-02-27 18:35         ` Cong Wang
2015-02-27 17:42       ` [PATCH v2 net] " Eric Dumazet
2015-02-28  0:43         ` Jεan Sacren
2015-02-28  1:05           ` Eric Dumazet
2015-03-01  5:29         ` David Miller
2015-02-27 17:28     ` [Patch net] netns: avoid allocating idr when dumping info Cong Wang
2015-02-27 17:48       ` Nicolas Dichtel
2015-02-28  0:56         ` Cong Wang
2015-02-28  6:17           ` Cong Wang [this message]
2015-02-27 18:04       ` Eric Dumazet
2015-02-28  0:48         ` Cong Wang

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=CAM_iQpV7sVimr+3BzA8ZYW-wixwxv29r4jGZFB1FfUwCGN8QxA@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    /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).