rcuja range: add rcu read lock/unlock in new/destroy
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 9 Jun 2013 21:05:44 +0000 (17:05 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 9 Jun 2013 21:05:44 +0000 (17:05 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rcuja/rcuja-range.c

index cb5b78b8b8e63365c79a72fae76b2e8f6177f237..faf60ce48feb86335a669d4de17973f2a2e93ad0 100644 (file)
@@ -405,7 +405,9 @@ struct cds_ja *_cds_ja_range_new(const struct rcu_flavor_struct *flavor)
        range = range_create(0, UINT64_MAX, NULL, CDS_JA_RANGE_FREE);
        if (!range)
                goto free_ja;
+       cds_lfht_rcu_flavor(ja->ht)->read_lock();
        ret = cds_ja_add(ja, 0, &range->ja_node);
+       cds_lfht_rcu_flavor(ja->ht)->read_unlock();
        if (ret)
                goto free_range;
        return ja;
@@ -425,6 +427,7 @@ int cds_ja_range_destroy(struct cds_ja *ja,
        struct cds_ja_node *ja_node;
        int ret = 0;
 
+       cds_lfht_rcu_flavor(ja->ht)->read_lock();
        cds_ja_for_each_key_rcu(ja, key, ja_node) {
                struct cds_ja_node *tmp_node;
 
@@ -442,8 +445,10 @@ int cds_ja_range_destroy(struct cds_ja *ja,
                        free_range(range);
                }
        }
+       cds_lfht_rcu_flavor(ja->ht)->read_unlock();
        return cds_ja_destroy(ja);
 
 error:
+       cds_lfht_rcu_flavor(ja->ht)->read_unlock();
        return ret;
 }
This page took 0.02569 seconds and 4 git commands to generate.