Skip to contentSkip to conversation

Revert "net: minor cleanup to net_namespace.c."

PATCH In review Alexey Dobriyan 2 participants 3 messages Jun 12, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "net: minor cleanup to net_namespace.c."

git revert 911cb193f3eb0370f20fbba712211e55ffede4de

commit 911cb193f3eb0370f20fbba712211e55ffede4de
Author: Rob Landley <[email protected]>
Date: Fri Apr 15 02:26:25 2011 +0000

net: minor cleanup to net_namespace.c.

Inline a small static function that's only ever called from one place.

Rationale for net_create() still holds:
* C/R and other out-of-tree code uses or will use it,
* permissions checks are separate thing (and different in C/R case),
* one function doesn't hurt anything.

---

 net/core/net_namespace.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
net/core/net_namespace.c +8 -4
@@ -210,14 +210,11 @@ static void net_free(struct net *net)
 	kmem_cache_free(net_cachep, net);
 }
 
-struct net *copy_net_ns(unsigned long flags, struct net *old_net)
+static struct net *net_create(void)
 {
 	struct net *net;
 	int rv;
 
-	if (!(flags & CLONE_NEWNET))
-		return get_net(old_net);
-
 	net = net_alloc();
 	if (!net)
 		return ERR_PTR(-ENOMEM);
@@ -236,6 +233,13 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
 	return net;
 }
 
+struct net *copy_net_ns(unsigned long flags, struct net *old_net)
+{
+	if (!(flags & CLONE_NEWNET))
+		return get_net(old_net);
+	return net_create();
+}
+
 static DEFINE_SPINLOCK(cleanup_list_lock);
 static LIST_HEAD(cleanup_list);  /* Must hold cleanup_list_lock to touch */
 
maintainer
#1 lore raw

From: Alexey Dobriyan <[email protected]>
Date: Sun, 12 Jun 2011 14:09:50 +0300

Quoted 1 line

* C/R and other out-of-tree code uses or will use it,

Submit this with the out-of-tree code that needs it, we never cater to external bits like this.

#2 lore raw
Quoted 7 lines · David Miller

From: Alexey Dobriyan <[email protected]>
Date: Sun, 12 Jun 2011 14:09:50 +0300

Quoted 1 line

* C/R and other out-of-tree code uses or will use it,

Submit this with the out-of-tree code that needs it, we never cater to external bits like this.

It is not like I'm asking for an ugly knob or something.

net_create() creates netns, and permission checks are done earlier in some other place.

Why would anyone merge them back, I can't understand.