From: David Goulet Date: Fri, 27 Sep 2013 21:41:42 +0000 (-0400) Subject: Fix: use session id when deleting viewer streams X-Git-Tag: v2.4.0-rc1~130 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b92fdc2bf5e3474d62c8d1c554ddd2a8fd2c043c;p=lttng-tools.git Fix: use session id when deleting viewer streams Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index ee3ecec65..cbf32790c 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -689,7 +689,7 @@ int viewer_attach_session(struct relay_command *cmd, } session = caa_container_of(node, struct relay_session, session_n); - if (cmd->session == session) { + if (cmd->session_id == session->id) { /* Same viewer already attached, just send the stream list. */ send_streams = 1; response.status = htobe32(VIEWER_ATTACH_OK); @@ -705,6 +705,7 @@ int viewer_attach_session(struct relay_command *cmd, session->viewer_attached++; send_streams = 1; response.status = htobe32(VIEWER_ATTACH_OK); + cmd->session_id = session->id; cmd->session = session; } @@ -1433,15 +1434,13 @@ void deferred_free_viewer_stream(struct rcu_head *head) } static -void viewer_del_streams(struct relay_session *session) +void viewer_del_streams(uint64_t session_id) { int ret; struct relay_viewer_stream *stream; struct lttng_ht_node_u64 *node; struct lttng_ht_iter iter; - assert(session); - rcu_read_lock(); cds_lfht_for_each_entry(viewer_streams_ht->ht, &iter.iter, node, node) { node = lttng_ht_iter_get_node_u64(&iter); @@ -1450,7 +1449,7 @@ void viewer_del_streams(struct relay_session *session) } stream = caa_container_of(node, struct relay_viewer_stream, stream_n); - if (stream->session_id != session->id) { + if (stream->session_id != session_id) { continue; } @@ -1494,9 +1493,7 @@ void del_connection(struct lttng_ht *relay_connections_ht, ret = lttng_ht_del(relay_connections_ht, iter); assert(!ret); - if (relay_connection->session) { - viewer_del_streams(relay_connection->session); - } + viewer_del_streams(relay_connection->session_id); call_rcu(&relay_connection->rcu_node, deferred_free_connection); } diff --git a/src/bin/lttng-relayd/lttng-relayd.h b/src/bin/lttng-relayd/lttng-relayd.h index 3c8c26c29..358615f9a 100644 --- a/src/bin/lttng-relayd/lttng-relayd.h +++ b/src/bin/lttng-relayd/lttng-relayd.h @@ -166,6 +166,7 @@ struct relay_command { uint32_t major; uint32_t minor; struct lttng_ht *ctf_traces_ht; /* indexed by path name */ + uint64_t session_id; }; struct relay_local_data {