From: Mathieu Desnoyers Date: Sun, 11 Sep 2011 01:32:45 +0000 (-0700) Subject: rculfhash: add assertion in path compression X-Git-Tag: v0.7.0~43^2~163 X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=commitdiff_plain;h=bd4db1530ed788ea97c8a9e4c0d04ef757181ad6 rculfhash: add assertion in path compression Detects incorrect usage of path compression. Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index 003ab0b..2565099 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -672,6 +672,13 @@ void _cds_lfht_gc_bucket(struct cds_lfht_node *dummy, struct cds_lfht_node *node /* We can always skip the dummy node initially */ iter = rcu_dereference(iter_prev->p.next); assert(iter_prev->p.reverse_hash <= node->p.reverse_hash); + /* + * We should never be called with dummy (start of chain) + * and logically removed node (end of path compression + * marker) being the actual same node. This would be a + * bug in the algorithm implementation. + */ + assert(dummy != node); for (;;) { if (unlikely(!clear_flag(iter))) return;