rculfhash: fix add unique
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 7 Jul 2011 15:13:06 +0000 (11:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 7 Jul 2011 15:13:06 +0000 (11:13 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rculfhash.c

index 11c0077977f327e5437a13d050f8eceb6e7a6a6b..1ccd3f15a5b8be89b8ca4fce5b34f1e588e9473e 100644 (file)
@@ -262,6 +262,12 @@ int _ht_add(struct rcu_ht *ht, struct rcu_table *t, struct rcu_ht_node *node,
                        next = rcu_dereference(clear_flag(iter)->next);
                        if (is_removed(next))
                                goto gc_node;
+                       if (unique
+                           && !clear_flag(iter)->dummy
+                           && !ht->compare_fct(node->key, node->key_len,
+                                               clear_flag(iter)->key,
+                                               clear_flag(iter)->key_len))
+                               return -EEXIST;
                        /* Only account for identical reverse hash once */
                        if (iter_prev->reverse_hash != clear_flag(iter)->reverse_hash)
                                check_resize(ht, t, ++chain_len);
This page took 0.025997 seconds and 4 git commands to generate.