Skip to contentSkip to conversation

ipcns: remove useless get/put while CLONE_NEWIPC

PATCH In review Alexey Dobriyan 3 participants 3 messages Apr 10, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 3/30 ipcns: remove useless get/put while CLONE_NEWIPC

copy_ipcs() doesn't actually copy anything. If new ipcns is created, it's created from scratch, in this case get/put on old ipcns isn't needed.

---

 ipc/namespace.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
ipc/namespace.c +1 -5
@@ -50,15 +50,11 @@ struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
 {
 	struct ipc_namespace *new_ns;
 
-	BUG_ON(!ns);
-	get_ipc_ns(ns);
-
 	if (!(flags & CLONE_NEWIPC))
-		return ns;
+		return get_ipc_ns(ns);
 
 	new_ns = clone_ipc_ns(ns);
 
-	put_ipc_ns(ns);
 	return new_ns;
 }
 
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Alexey Dobriyan

copy_ipcs() doesn't actually copy anything. If new ipcns is created, it's created from scratch, in this case get/put on old ipcns isn't needed.

Yeah, I like this change just for the diffstat.

How about breaking these out from the c/r set?

thanks,
-serge

Quoted 23 lines

---

 ipc/namespace.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
ipc/namespace.c +1 -5
@@ -50,15 +50,11 @@ struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
 {
 	struct ipc_namespace *new_ns;
 
-	BUG_ON(!ns);
-	get_ipc_ns(ns);
-
 	if (!(flags & CLONE_NEWIPC))
-		return ns;
+		return get_ipc_ns(ns);
 
 	new_ns = clone_ipc_ns(ns);
 
-	put_ipc_ns(ns);
 	return new_ns;
 }
Acked-by on v1 3/30
#3 lore raw
In reply to Alexey Dobriyan
Quoted 4 lines · Alexey Dobriyan

copy_ipcs() doesn't actually copy anything. If new ipcns is created, it's created from scratch, in this case get/put on old ipcns isn't needed.

Yeah, I like this change just for the diffstat.

How about breaking these out from the c/r set?

thanks,
-serge

Quoted 23 lines

---

 ipc/namespace.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
ipc/namespace.c +1 -5
@@ -50,15 +50,11 @@ struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
 {
 	struct ipc_namespace *new_ns;
 
-	BUG_ON(!ns);
-	get_ipc_ns(ns);
-
 	if (!(flags & CLONE_NEWIPC))
-		return ns;
+		return get_ipc_ns(ns);
 
 	new_ns = clone_ipc_ns(ns);
 
-	put_ipc_ns(ns);
 	return new_ns;
 }