2009-04-10 02:33:56

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH 03/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.

Signed-off-by: Alexey Dobriyan <[email protected]>
---

ipc/namespace.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -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;
}


2009-04-10 15:19:47

by Serge E. Hallyn

[permalink] [raw]
Subject: Re: [PATCH 03/30] ipcns: remove useless get/put while CLONE_NEWIPC

Quoting Alexey Dobriyan ([email protected]):
> 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 <[email protected]>

Yeah, I like this change just for the diffstat.

Acked-by: Serge Hallyn <[email protected]>

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

thanks,
-serge

> ---
>
> ipc/namespace.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> --- a/ipc/namespace.c
> +++ b/ipc/namespace.c
> @@ -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;
> }