[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <21d7e9970812101546n40ba9043r8fdf35b986c5d377@mail.gmail.com>
Date: Thu, 11 Dec 2008 09:46:12 +1000
From: "Dave Airlie" <airlied@...il.com>
To: "Manfred Spraul" <manfred@...orfullife.com>
Cc: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
cebbert@...hat.com, akpm@...ux-foundation.org
Subject: Re: [PATCH] lib/idr.c: Fix bug introduced by RCU fix
On Thu, Dec 11, 2008 at 3:17 AM, Manfred Spraul
<manfred@...orfullife.com> wrote:
> The last patch to lib/idr.c caused a bug if idr_get_new_above() was
> called on an empty idr:
> Usually, nodes stay on the same layer. New layers are added to the top
> of the tree.
> The exception is idr_get_new_above() on an empty tree: In this case,
> the new root node is first added on layer 0, then moved upwards.
> p->layer was not updated.
>
> As usual: You shall never rely on the source code comments, they
> will only mislead you.
>
> Signed-off-by: Manfred Spraul <manfred@...orfullife.com>
I've given this a run on my dri system and it appears to work great.
Tested-by: Dave Airlie <airlied@...hat.com>
> ---
> lib/idr.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/lib/idr.c b/lib/idr.c
> index 7a785a0..1c4f928 100644
> --- a/lib/idr.c
> +++ b/lib/idr.c
> @@ -220,8 +220,14 @@ build_up:
> */
> while ((layers < (MAX_LEVEL - 1)) && (id >= (1 << (layers*IDR_BITS)))) {
> layers++;
> - if (!p->count)
> + if (!p->count) {
> + /* special case: if the tree is currently empty,
> + * then we grow the tree by moving the top node
> + * upwards.
> + */
> + p->layer++;
> continue;
> + }
> if (!(new = get_from_free_list(idp))) {
> /*
> * The allocation failed. If we built part of
> --
> 1.5.6.5
>
>
--
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