Fix: remove logically dead code in send_channel_uid_to_ust
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index 4066b065c0a0b45185e0f18b18820bde9f344c73..c60d7210e6ac57f8d208cd86d59d487eab1b3438 100644 (file)
@@ -2706,9 +2706,6 @@ static int send_channel_uid_to_ust(struct buffer_reg_channel *reg_chan,
                        (void) release_ust_app_stream(-1, &stream, app);
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                ret = -ENOTCONN; /* Caused by app exiting. */
-                               goto error_stream_unlock;
-                       } else if (ret < 0) {
-                               goto error_stream_unlock;
                        }
                        goto error_stream_unlock;
                }
@@ -3482,7 +3479,9 @@ int ust_app_list_events(struct lttng_event **events)
                                }
                                free(tmp_event);
                                release_ret = ustctl_release_handle(app->sock, handle);
-                               if (release_ret != -LTTNG_UST_ERR_EXITING && release_ret != -EPIPE) {
+                               if (release_ret < 0 &&
+                                               release_ret != -LTTNG_UST_ERR_EXITING &&
+                                               release_ret != -EPIPE) {
                                        ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
                                }
                                pthread_mutex_unlock(&app->sock_lock);
@@ -3507,7 +3506,9 @@ int ust_app_list_events(struct lttng_event **events)
                                        free(tmp_event);
                                        ret = -ENOMEM;
                                        release_ret = ustctl_release_handle(app->sock, handle);
-                                       if (release_ret != -LTTNG_UST_ERR_EXITING && release_ret != -EPIPE) {
+                                       if (release_ret < 0 &&
+                                                       release_ret != -LTTNG_UST_ERR_EXITING &&
+                                                       release_ret != -EPIPE) {
                                                ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
                                        }
                                        pthread_mutex_unlock(&app->sock_lock);
@@ -3528,7 +3529,7 @@ int ust_app_list_events(struct lttng_event **events)
                }
                ret = ustctl_release_handle(app->sock, handle);
                pthread_mutex_unlock(&app->sock_lock);
-               if (ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) {
+               if (ret < 0 && ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) {
                        ERR("Error releasing app handle for app %d with ret %d", app->sock, ret);
                }
        }
@@ -3610,7 +3611,9 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
                                free(tmp_event);
                                release_ret = ustctl_release_handle(app->sock, handle);
                                pthread_mutex_unlock(&app->sock_lock);
-                               if (release_ret != -LTTNG_UST_ERR_EXITING && release_ret != -EPIPE) {
+                               if (release_ret < 0 &&
+                                               release_ret != -LTTNG_UST_ERR_EXITING &&
+                                               release_ret != -EPIPE) {
                                        ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
                                }
                                goto rcu_error;
@@ -3635,7 +3638,9 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
                                        ret = -ENOMEM;
                                        release_ret = ustctl_release_handle(app->sock, handle);
                                        pthread_mutex_unlock(&app->sock_lock);
-                                       if (release_ret != -LTTNG_UST_ERR_EXITING && release_ret != -EPIPE) {
+                                       if (release_ret &&
+                                                       release_ret != -LTTNG_UST_ERR_EXITING &&
+                                                       release_ret != -EPIPE) {
                                                ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
                                        }
                                        goto rcu_error;
@@ -3661,7 +3666,9 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
                }
                ret = ustctl_release_handle(app->sock, handle);
                pthread_mutex_unlock(&app->sock_lock);
-               if (ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) {
+               if (ret < 0 &&
+                               ret != -LTTNG_UST_ERR_EXITING &&
+                               ret != -EPIPE) {
                        ERR("Error releasing app handle for app %d with ret %d", app->sock, ret);
                }
        }
@@ -3873,7 +3880,7 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
 {
        int ret = 0;
        struct lttng_ht_iter iter, uiter;
-       struct lttng_ht_node_str *ua_chan_node, *ua_event_node;
+       struct lttng_ht_node_str *ua_chan_node;
        struct ust_app *app;
        struct ust_app_session *ua_sess;
        struct ust_app_channel *ua_chan;
@@ -3910,14 +3917,14 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
                }
                ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
 
-               lttng_ht_lookup(ua_chan->events, (void *)uevent->attr.name, &uiter);
-               ua_event_node = lttng_ht_iter_get_node_str(&uiter);
-               if (ua_event_node == NULL) {
+               ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
+                               uevent->filter, uevent->attr.loglevel,
+                               uevent->exclusion);
+               if (ua_event == NULL) {
                        DBG2("Event %s not found in channel %s for app pid %d."
                                        "Skipping", uevent->attr.name, uchan->name, app->pid);
                        continue;
                }
-               ua_event = caa_container_of(ua_event_node, struct ust_app_event, node);
 
                ret = disable_ust_app_event(ua_sess, ua_event, app);
                if (ret < 0) {
@@ -4422,7 +4429,6 @@ int ust_app_flush_app_session(struct ust_app *app,
                cds_lfht_for_each_entry(ua_sess->channels->ht, &iter.iter, ua_chan,
                                node.node) {
                        health_code_update();
-                       assert(ua_chan->is_sent);
                        ret = consumer_flush_channel(socket, ua_chan->key);
                        if (ret) {
                                ERR("Error flushing consumer channel");
@@ -5465,7 +5471,6 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                uint64_t nb_packets_per_stream)
 {
        int ret = 0;
-       unsigned int snapshot_done = 0;
        struct lttng_ht_iter iter;
        struct ust_app *app;
        char pathname[PATH_MAX];
@@ -5517,7 +5522,6 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                        if (ret < 0) {
                                goto error;
                        }
-                       snapshot_done = 1;
                }
                break;
        }
@@ -5570,7 +5574,6 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                        if (ret < 0) {
                                goto error;
                        }
-                       snapshot_done = 1;
                }
                break;
        }
@@ -5579,15 +5582,6 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                break;
        }
 
-       if (!snapshot_done) {
-               /*
-                * If no snapshot was made and we are not in the error path, this means
-                * that there are no buffers thus no (prior) application to snapshot
-                * data from so we have simply NO data.
-                */
-               ret = -ENODATA;
-       }
-
 error:
        rcu_read_unlock();
        return ret;
This page took 0.024959 seconds and 4 git commands to generate.