From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754817AbcKNR3v (ORCPT ); Mon, 14 Nov 2016 12:29:51 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:43794 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933929AbcKNR3i (ORCPT ); Mon, 14 Nov 2016 12:29:38 -0500 X-ME-Sender: Message-Id: <1479144577.3734328.787380169.651B5477@webmail.messagingengine.com> From: Hannes Frederic Sowa To: Cong Wang , "Paul E. McKenney" Cc: Rolf Neugebauer , LKML , Linux Kernel Network Developers , Justin Cormack , Ian Campbell MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-95dfd397 References: <20161110212404.GB4127@linux.vnet.ibm.com> <20161112002347.GL4127@linux.vnet.ibm.com> Subject: Re: Long delays creating a netns after deleting one (possibly RCU related) Date: Mon, 14 Nov 2016 18:29:37 +0100 In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Cong, On Sat, Nov 12, 2016, at 01:55, Cong Wang wrote: > On Fri, Nov 11, 2016 at 4:23 PM, Paul E. McKenney > wrote: > > > > Ah! This net_mutex is different than RTNL. Should synchronize_net() be > > modified to check for net_mutex being held in addition to the current > > checks for RTNL being held? > > > > Good point! > > Like commit be3fc413da9eb17cce0991f214ab0, checking > for net_mutex for this case seems to be an optimization, I assume > synchronize_rcu_expedited() and synchronize_rcu() have the same > behavior... > > diff --git a/net/core/dev.c b/net/core/dev.c > index eaad4c2..3415b6b 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -7762,7 +7762,7 @@ EXPORT_SYMBOL(free_netdev); > void synchronize_net(void) > { > might_sleep(); > - if (rtnl_is_locked()) > + if (rtnl_is_locked() || lockdep_is_held(&net_mutex)) > synchronize_rcu_expedited(); I don't think we should depend on lockdep for this check but rather use mutex_is_locked here (I think it would fail to build like this without CONFIG_LOCKDEP). Bye, Hannes