netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] netns: call ops_free right after ops_exit
@ 2010-04-25  9:26 Jiri Pirko
  2010-04-25  9:59 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Pirko @ 2010-04-25  9:26 UTC (permalink / raw)
  To: netdev; +Cc: davem, ebiederm

There's no need to iterate this twice. We can free net generic variables right
after exit is called.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index bd8c471..16217bc 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -82,7 +82,7 @@ static void ops_free_list(const struct pernet_operations *ops,
 static __net_init int setup_net(struct net *net)
 {
 	/* Must be called with net_mutex held */
-	const struct pernet_operations *ops, *saved_ops;
+	const struct pernet_operations *ops;
 	int error = 0;
 	LIST_HEAD(net_exit_list);
 
@@ -105,13 +105,10 @@ out_undo:
 	 * for the pernet modules whose init functions did not fail.
 	 */
 	list_add(&net->exit_list, &net_exit_list);
-	saved_ops = ops;
-	list_for_each_entry_continue_reverse(ops, &pernet_list, list)
+	list_for_each_entry_continue_reverse(ops, &pernet_list, list) {
 		ops_exit_list(ops, &net_exit_list);
-
-	ops = saved_ops;
-	list_for_each_entry_continue_reverse(ops, &pernet_list, list)
 		ops_free_list(ops, &net_exit_list);
+	}
 
 	rcu_barrier();
 	goto out;
@@ -231,13 +228,14 @@ static void cleanup_net(struct work_struct *work)
 	 */
 	synchronize_rcu();
 
-	/* Run all of the network namespace exit methods */
-	list_for_each_entry_reverse(ops, &pernet_list, list)
+	/*
+	 * Run all of the network namespace exit methods and free
+	 * the net generic variables
+	 */
+	list_for_each_entry_reverse(ops, &pernet_list, list) {
 		ops_exit_list(ops, &net_exit_list);
-
-	/* Free the net generic variables */
-	list_for_each_entry_reverse(ops, &pernet_list, list)
 		ops_free_list(ops, &net_exit_list);
+	}
 
 	mutex_unlock(&net_mutex);
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-04-26 10:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-25  9:26 [PATCH net-next-2.6] netns: call ops_free right after ops_exit Jiri Pirko
2010-04-25  9:59 ` David Miller
2010-04-25 14:50   ` Eric W. Biederman
2010-04-25 18:44     ` Jiri Pirko
2010-04-26  3:06       ` Eric W. Biederman
2010-04-26 10:43         ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).