ipcns: remove useless get/put while CLONE_NEWIPC
Alexey Dobriyan [Wed, 17 Jun 2009 23:27:54 +0000 (16:27 -0700)]
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.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

ipc/namespace.c

index 4a5e752..a56fc59 100644 (file)
@@ -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;
 }