[PATCH 10/13] Fix ridr_find()

From: Nadia . Derbey
Date: Fri Apr 11 2008 - 12:23:17 EST


[PATCH 10/13]

This patch only fixes the ridr_find() portion of ridr.c,
to make it RCU based.

Signed-off-by: Nadia Derbey <Nadia.Derbey@xxxxxxxx>

---
lib/ridr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.25-rc8-mm1/lib/ridr.c
===================================================================
--- linux-2.6.25-rc8-mm1.orig/lib/ridr.c 2008-04-11 18:04:08.000000000 +0200
+++ linux-2.6.25-rc8-mm1/lib/ridr.c 2008-04-11 18:09:00.000000000 +0200
@@ -381,7 +381,7 @@ void *ridr_find(struct ridr *idp, int id
struct ridr_layer *p;

n = idp->layers * IDR_BITS;
- p = idp->top;
+ p = rcu_dereference(idp->top);

/* Mask off upper bits we don't use for the search. */
id &= MAX_ID_MASK;
@@ -391,7 +391,7 @@ void *ridr_find(struct ridr *idp, int id

while (n > 0 && p) {
n -= IDR_BITS;
- p = p->ary[(id >> n) & IDR_MASK];
+ p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
}
return((void *)p);
}

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/