From ed35e6d83818d603682c7adafe7f32f05826e204 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 30 Sep 2011 12:50:11 -0400 Subject: [PATCH] rculfhash: decrement resize cnt on destroy Signed-off-by: Mathieu Desnoyers --- rculfhash.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rculfhash.c b/rculfhash.c index 93514d4..8a9e097 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -1720,8 +1720,10 @@ void cds_lfht_resize_lazy(struct cds_lfht *ht, unsigned long size, int growth) if (!CMM_LOAD_SHARED(ht->t.resize_initiated) && size < target_size) { uatomic_inc(&ht->in_progress_resize); cmm_smp_mb(); /* increment resize count before load destroy */ - if (CMM_LOAD_SHARED(ht->in_progress_destroy)) + if (CMM_LOAD_SHARED(ht->in_progress_destroy)) { + uatomic_dec(&ht->in_progress_resize); return; + } work = malloc(sizeof(*work)); work->ht = ht; ht->cds_lfht_call_rcu(&work->head, do_resize_cb); @@ -1745,8 +1747,10 @@ void cds_lfht_resize_lazy_count(struct cds_lfht *ht, unsigned long size, if (!CMM_LOAD_SHARED(ht->t.resize_initiated)) { uatomic_inc(&ht->in_progress_resize); cmm_smp_mb(); /* increment resize count before load destroy */ - if (CMM_LOAD_SHARED(ht->in_progress_destroy)) + if (CMM_LOAD_SHARED(ht->in_progress_destroy)) { + uatomic_dec(&ht->in_progress_resize); return; + } work = malloc(sizeof(*work)); work->ht = ht; ht->cds_lfht_call_rcu(&work->head, do_resize_cb); -- 2.34.1