Netdev List
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: davem@davemloft.net, nicolas.dichtel@6wind.com,
	vyasevic@redhat.com, ktkhai@virtuozzo.com,
	paulmck@linux.vnet.ibm.com, vyasevich@gmail.com,
	mark.rutland@arm.com, gregkh@linuxfoundation.org,
	leonro@mellanox.com, avagin@virtuozzo.com, fw@strlen.de,
	roman.kapl@sysgo.com, netdev@vger.kernel.org
Subject: [PATCH 3/3] net: Queue net_cleanup_work only if there is first net added
Date: Mon, 19 Feb 2018 12:58:54 +0300	[thread overview]
Message-ID: <151903433442.8021.12730991801718645322.stgit@localhost.localdomain> (raw)
In-Reply-To: <151903409491.8021.11032992295248447417.stgit@localhost.localdomain>

When llist_add() returns false, cleanup_net() hasn't made its
llist_del_all(), while the work has already been scheduled
by the first queuer. So, we may skip queue_work() in this case.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 net/core/net_namespace.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index abf8a46e94e2..27a55236ad64 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -582,8 +582,8 @@ static DECLARE_WORK(net_cleanup_work, cleanup_net);
 void __put_net(struct net *net)
 {
 	/* Cleanup the network namespace in process context */
-	llist_add(&net->cleanup_list, &cleanup_list);
-	queue_work(netns_wq, &net_cleanup_work);
+	if (llist_add(&net->cleanup_list, &cleanup_list))
+		queue_work(netns_wq, &net_cleanup_work);
 }
 EXPORT_SYMBOL_GPL(__put_net);
 

  parent reply	other threads:[~2018-02-19  9:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19  9:58 [PATCH 0/3] net: Get rid of net_mutex and simplify cleanup_list queueing Kirill Tkhai
2018-02-19  9:58 ` [PATCH 1/3] net: Kill net_mutex Kirill Tkhai
2018-02-20 23:18   ` Stephen Hemminger
2018-02-21 10:16     ` Kirill Tkhai
2018-02-19  9:58 ` [PATCH 2/3] net: Make cleanup_list and net::cleanup_list of llist type Kirill Tkhai
2018-02-20 19:42   ` Cong Wang
2018-02-21  8:30     ` Kirill Tkhai
2018-02-19  9:58 ` Kirill Tkhai [this message]
2018-02-19 13:52 ` [PATCH 0/3] net: Get rid of net_mutex and simplify cleanup_list queueing Kirill Tkhai
2018-02-20 18:24 ` David Miller

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=151903433442.8021.12730991801718645322.stgit@localhost.localdomain \
    --to=ktkhai@virtuozzo.com \
    --cc=avagin@virtuozzo.com \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=leonro@mellanox.com \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=roman.kapl@sysgo.com \
    --cc=vyasevic@redhat.com \
    --cc=vyasevich@gmail.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