From: Hans Schillstrom Subject: Re: [PATCH 1/2] ipvs: reset ipvs pointer in netns Date: Fri, 13 Apr 2012 11:29:09 +0200 Message-ID: <201204131129.10283.hans.schillstrom@ericsson.com> References: <1334306642-3765-1-git-send-email-ja@ssi.bg> <1334306642-3765-2-git-send-email-ja@ssi.bg> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1334306642-3765-2-git-send-email-ja@ssi.bg> Content-Disposition: inline Sender: lvs-devel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Julian Anastasov Cc: Simon Horman , "lvs-devel@vger.kernel.org" Hello Julian On Friday 13 April 2012 10:44:01 Julian Anastasov wrote: > Make sure net->ipvs is reset on netns cleanup or failed > initialization. It is needed for IPVS applications to know that > IPVS core is not loaded in netns. > > Signed-off-by: Julian Anastasov > --- > net/netfilter/ipvs/ip_vs_core.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c > index 2555816..260b9ef 100644 > --- a/net/netfilter/ipvs/ip_vs_core.c > +++ b/net/netfilter/ipvs/ip_vs_core.c > @@ -1924,6 +1924,7 @@ protocol_fail: > control_fail: > ip_vs_estimator_net_cleanup(net); > estimator_fail: > + net->ipvs = NULL; You can't do this since name space cleanup will call __ip_vs_cleanup later and that will cause NULL pointer problems Note that any netns init faiulure will be rolled back later by net_namespace.c And you will not receive any trafic into a namepace until all init is OK > return -ENOMEM; > } > > @@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) > ip_vs_control_net_cleanup(net); > ip_vs_estimator_net_cleanup(net); > IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); > + net->ipvs = NULL; > } > > static void __net_exit __ip_vs_dev_cleanup(struct net *net) -- Regards Hans Schillstrom