public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: ebiederm@xmission•com (Eric W. Biederman)
To: canqun zhang <canqunzhang@gmail•com>
Cc: Gao feng <gaofeng@cn•fujitsu.com>,
	netfilter-devel@vger•kernel.org,
	"netdev\@vger.kernel.org" <netdev@vger•kernel.org>,
	Patrick McHardy <kaber@trash•net>,
	pablo@netfilter•org
Subject: Re: [PATCH 01/19] netfilter: move nf_conntrack initialize out of pernet operations
Date: Thu, 27 Dec 2012 20:48:44 -0800	[thread overview]
Message-ID: <87ip7mlr2r.fsf@xmission.com> (raw)
In-Reply-To: <CAFFEFTXT_fkF2pPSxDEEgic80NVWLqBWtFuvs6W9uDUW2aCnqw@mail.gmail.com> (canqun zhang's message of "Fri, 28 Dec 2012 11:52:13 +0800")

canqun zhang <canqunzhang@gmail•com> writes:

> Hi all
> As discussed above,if the host machine create several linux
> containers, there will be several  net namespaces.Resources with "nf
> conntrack" are registered or unregistered on the first net
> namespace(init_net),But init_net is not unregistered lastly,so
> cleanuping other net namespaces  will triger painic.
> If net namespaces are created  with the order of 1,2,...n,they should
> be cleaned with the order of n,...2,1,so in this case init_net will be
> unregistered lastly.

No.  Network namespaces in general can be cleaned up in any order.

In particular you should never ever expect to see the order
n,n-1,n-2,...,2,1.

It may make sense to special case init_net in the cleanup order
but I would really rather not.

Now init_net is special and really should never be cleaned up
for non-modular code.  So it almost makes sense to special
case init_net.

Does anyone know why Alexy decided to do this only for init_net?

My inclination is that Gao Feng is on the rigt path by just removing
the strange init_net special case and performing the work once
per module load, and once per module unload.

> I fixed it up (see below). I have taken a lot of test!

Thank you.

It is nice to see that we have exposed this mis-assumption.

I am inclined to leave the order of this list as is so that
other assumptions of network namespace unregistration order
are exposed.

Unless there is a truly good reason to perform magic on init_net.

Eric

> diff -r 6a1a258923f5 -r 2667e89e6f50 net/core/net_namespace.c
> --- a/net/core/net_namespace.c  Fri Dec 28 11:01:17 2012 +0800
> +++ b/net/core/net_namespace.c  Fri Dec 28 11:05:12 2012 +0800
> @@ -450,7 +450,7 @@
>
>         list_del(&ops->list);
>         for_each_net(net)
> -               list_add_tail(&net->exit_list, &net_exit_list);
> +              list_add(&net->exit_list, &net_exit_list);
>         ops_exit_list(ops, &net_exit_list);
>         ops_free_list(ops, &net_exit_lis
>

  reply	other threads:[~2012-12-28  4:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-28  2:36 [PATCH 01/19] netfilter: move nf_conntrack initialize out of pernet operations Gao feng
2012-12-28  2:36 ` [PATCH 02/19] netfilter: expect: move initial codes out of pernet_operations Gao feng
2012-12-28  2:36 ` [PATCH 03/19] netfilter: acct: " Gao feng
2012-12-28  2:36 ` [PATCH 04/19] netfilter: tstamp: " Gao feng
2012-12-28  2:36 ` [PATCH 05/19] netfilter: ecache: " Gao feng
2012-12-28  2:36 ` [PATCH 06/19] netfilter: timeout: " Gao feng
2012-12-28  2:36 ` [PATCH 07/19] netfilter: helper: " Gao feng
2012-12-28  2:36 ` [PATCH 08/19] netfilter: proto: " Gao feng
2012-12-28  2:36 ` [PATCH 09/19] netfilter: l3proto: prepare reworking l3proto support for netns Gao feng
2012-12-28  2:36 ` [PATCH 10/19] netfilter: ipv4: register ipv4 in module_init Gao feng
2012-12-28  2:36 ` [PATCH 10/19] netfilter: ipv4: register l3proto " Gao feng
2012-12-28  2:36 ` [PATCH 11/19] netfilter: ipv6: register l3proto ipv6 " Gao feng
2012-12-28  2:36 ` [PATCH 12/19] netfilter: l4proto: prepare reworking l4proto support for netns Gao feng
2012-12-28  2:36 ` [PATCH 13/19] netfilter: ipv4: move registration codes out of pernet_operations Gao feng
2012-12-28  2:36 ` [PATCH 14/19] netfilter: ipv6: " Gao feng
2012-12-28  2:36 ` [PATCH 15/19] netfilter: sctp: " Gao feng
2012-12-28  2:36 ` [PATCH 16/19] netfilter: udplite: " Gao feng
2012-12-28  2:36 ` [PATCH 17/19] netfilter: dccp: " Gao feng
2012-12-28  2:36 ` [PATCH 18/19] netfilter: gre: " Gao feng
2012-12-28  2:36 ` [PATCH 19/19] netfilter: gre: fix resource leak when unregister gre proto Gao feng
2013-01-05  3:50   ` Pablo Neira Ayuso
2013-01-07  1:27     ` Gao feng
2013-01-07  2:15       ` Pablo Neira Ayuso
2013-01-07  2:38         ` Pablo Neira Ayuso
2013-01-07  2:59           ` Gao feng
2013-01-07  3:05             ` Gao feng
2013-01-07  3:27               ` Pablo Neira Ayuso
2013-01-07  3:43                 ` Gao feng
2012-12-28  3:52 ` [PATCH 01/19] netfilter: move nf_conntrack initialize out of pernet operations canqun zhang
2012-12-28  4:48   ` Eric W. Biederman [this message]
2012-12-28  5:32     ` canqun zhang
2012-12-28  6:00       ` Eric W. Biederman
2012-12-28 11:58     ` Pablo Neira Ayuso
2012-12-28  7:16   ` Gao feng
2012-12-28  8:48     ` canqun zhang
2013-01-10  1:03       ` Gao feng
2013-01-10 16:41 ` Pablo Neira Ayuso
2013-01-11  1:01   ` Gao feng
2013-01-13 15:07     ` Pablo Neira Ayuso

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=87ip7mlr2r.fsf@xmission.com \
    --to=ebiederm@xmission$(echo .)com \
    --cc=canqunzhang@gmail$(echo .)com \
    --cc=gaofeng@cn$(echo .)fujitsu.com \
    --cc=kaber@trash$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=netfilter-devel@vger$(echo .)kernel.org \
    --cc=pablo@netfilter$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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