From: Mathieu Desnoyers Date: Tue, 30 Apr 2013 00:28:10 +0000 (-0400) Subject: fix: rculfhash don't change qsbr online state X-Git-Tag: v0.8.0~94 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a1e5e232288fc2bc58502f5161e9ae4460b7133c;p=urcu.git fix: rculfhash don't change qsbr online state resize and destroy should not change the QSBR online state. Use the new rcu_read_ongoing() API for this. Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index e0be7df..6e12db1 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -1737,15 +1737,18 @@ int cds_lfht_delete_bucket(struct cds_lfht *ht) */ int cds_lfht_destroy(struct cds_lfht *ht, pthread_attr_t **attr) { - int ret; + int ret, was_online; /* Wait for in-flight resize operations to complete */ _CMM_STORE_SHARED(ht->in_progress_destroy, 1); cmm_smp_mb(); /* Store destroy before load resize */ - ht->flavor->thread_offline(); + was_online = ht->flavor->read_ongoing(); + if (was_online) + ht->flavor->thread_offline(); while (uatomic_read(&ht->in_progress_resize)) poll(NULL, 0, 100); /* wait for 100ms */ - ht->flavor->thread_online(); + if (was_online) + ht->flavor->thread_online(); ret = cds_lfht_delete_bucket(ht); if (ret) return ret; @@ -1881,13 +1884,18 @@ void resize_target_update_count(struct cds_lfht *ht, void cds_lfht_resize(struct cds_lfht *ht, unsigned long new_size) { + int was_online; + resize_target_update_count(ht, new_size); CMM_STORE_SHARED(ht->resize_initiated, 1); - ht->flavor->thread_offline(); + was_online = ht->flavor->read_ongoing(); + if (was_online) + ht->flavor->thread_offline(); pthread_mutex_lock(&ht->resize_mutex); _do_cds_lfht_resize(ht); pthread_mutex_unlock(&ht->resize_mutex); - ht->flavor->thread_online(); + if (was_online) + ht->flavor->thread_online(); } static