[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20121006191400.GA24391@redhat.com>
Date: Sat, 6 Oct 2012 21:14:00 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Vagin <avagin@...nvz.org>
Cc: linux-kernel@...r.kernel.org, criu@...nvz.org,
Pavel Emelyanov <xemul@...allels.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH] pidns: remove recursion from free_pid_ns (v2)
On 10/06, Andrew Vagin wrote:
>
> --- a/kernel/pid_namespace.c
> +++ b/kernel/pid_namespace.c
> @@ -138,11 +138,20 @@ void free_pid_ns(struct kref *kref)
>
> ns = container_of(kref, struct pid_namespace, kref);
>
> - parent = ns->parent;
> - destroy_pid_namespace(ns);
> + while (1) {
>
> - if (parent != NULL)
> - put_pid_ns(parent);
> + parent = ns->parent;
> + destroy_pid_namespace(ns);
> +
> + if (parent == &init_pid_ns)
> + break;
> +
> + /* kref_put cannot be used for avoiding recursion */
> + if (__kref_put(&parent->kref) == 0)
> + break;
> +
> + ns = parent;
> + }
> }
Reviewed-by: Oleg Nesterov <oleg@...hat.com>
But, Andrew... please note that this adds the unnecessary empty
line after "while (1)". The coding style police will complain
anyway, so I'd suggest you to send v3 ;)
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists