Add missing rcu read lock and add assert
authorDavid Goulet <dgoulet@efficios.com>
Wed, 11 Jan 2012 20:21:58 +0000 (15:21 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 11 Jan 2012 20:21:58 +0000 (15:21 -0500)
Signed-off-by: David Goulet <dgoulet@efficios.com>
lttng-sessiond/channel.c
lttng-sessiond/trace-ust.c

index 7ff974da05930c772b5734e1e7de3d4098766df8..b4dc48d161e662f12678e5d8de900e5a7c2761b0 100644 (file)
@@ -266,6 +266,10 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain,
        return LTTCOMM_OK;
 
 error_free_chan:
        return LTTCOMM_OK;
 
 error_free_chan:
+       /*
+        * No need to remove the channel from the hash table because at this point
+        * it was not added hence the direct call and no call_rcu().
+        */
        trace_ust_destroy_channel(uchan);
 error:
        free(defattr);
        trace_ust_destroy_channel(uchan);
 error:
        free(defattr);
index 0bfcc3bd811ddb3cc4babf55ada1d8fe2686db30..e4a5218110d78258973868aa11925623415816ce 100644 (file)
@@ -396,9 +396,8 @@ void trace_ust_destroy_channel(struct ltt_ust_channel *channel)
 
        cds_lfht_for_each_entry(channel->events->ht, &iter.iter, node, node) {
                ret = lttng_ht_del(channel->events, &iter);
 
        cds_lfht_for_each_entry(channel->events->ht, &iter.iter, node, node) {
                ret = lttng_ht_del(channel->events, &iter);
-               if (!ret) {
-                       destroy_event(channel->events);
-               }
+               assert(!ret);
+               destroy_event(channel->events);
        }
 
        destroy_context(channel->ctx);
        }
 
        destroy_context(channel->ctx);
@@ -439,6 +438,8 @@ static void destroy_channels(struct lttng_ht *channels)
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
 
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
 
+       rcu_read_lock();
+
        cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) {
                ret = lttng_ht_del(channels, &iter);
                if (!ret) {
        cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) {
                ret = lttng_ht_del(channels, &iter);
                if (!ret) {
@@ -447,6 +448,8 @@ static void destroy_channels(struct lttng_ht *channels)
        }
 
        lttng_ht_destroy(channels);
        }
 
        lttng_ht_destroy(channels);
+
+       rcu_read_unlock();
 }
 
 /*
 }
 
 /*
This page took 0.026411 seconds and 4 git commands to generate.