Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8349efd9 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by David S. Miller
Browse files

net: Queue net_cleanup_work only if there is first net added



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: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65b7b5b9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -582,7 +582,7 @@ 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);
	if (llist_add(&net->cleanup_list, &cleanup_list))
		queue_work(netns_wq, &net_cleanup_work);
}
EXPORT_SYMBOL_GPL(__put_net);