This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_GET_CHANNEL command. This is done in order to allow a
follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended beyond additional calls to
health_code_update() in some code paths which should have no impact.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
if (!channel) {
ERR("UST consumer get channel key %" PRIu64 " not found", key);
ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
if (!channel) {
ERR("UST consumer get channel key %" PRIu64 " not found", key);
ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
* and the consumer can continue its work. The above call
* has sent the error status message to the sessiond.
*/
* and the consumer can continue its work. The above call
* has sent the error status message to the sessiond.
*/
+ goto end_get_channel_nosignal;
}
/*
* The communicaton was broken hence there is a bad state between
* the consumer and sessiond so stop everything.
*/
}
/*
* The communicaton was broken hence there is a bad state between
* the consumer and sessiond so stop everything.
*/
+ goto error_get_channel_fatal;
* so don't send them to the data thread.
*/
if (!channel->monitor) {
* so don't send them to the data thread.
*/
if (!channel->monitor) {
}
ret = send_streams_to_thread(channel, ctx);
}
ret = send_streams_to_thread(channel, ctx);
* If we are unable to send the stream to the thread, there is
* a big problem so just stop everything.
*/
* If we are unable to send the stream to the thread, there is
* a big problem so just stop everything.
*/
+ goto error_get_channel_fatal;
}
/* List MUST be empty after or else it could be reused. */
assert(cds_list_empty(&channel->streams.head));
}
/* List MUST be empty after or else it could be reused. */
assert(cds_list_empty(&channel->streams.head));
+error_get_channel_fatal:
+ goto error_fatal;
+end_get_channel_nosignal:
+ goto end_nosignal;
}
case LTTNG_CONSUMER_DESTROY_CHANNEL:
{
}
case LTTNG_CONSUMER_DESTROY_CHANNEL:
{
- rcu_read_unlock();
-
- health_code_update();
-
/*
* Return 1 to indicate success since the 0 value can be a socket
* shutdown during the recv() or send() call.
*/
/*
* Return 1 to indicate success since the 0 value can be a socket
* shutdown during the recv() or send() call.
*/
if (ret < 0) {
goto error_fatal;
}
if (ret < 0) {
goto error_fatal;
}
- rcu_read_unlock();
-
- health_code_update();
end_channel_error:
if (channel) {
pthread_mutex_unlock(&channel->lock);
end_channel_error:
if (channel) {
pthread_mutex_unlock(&channel->lock);
/* Stop everything if session daemon can not be notified. */
goto error_fatal;
}
/* Stop everything if session daemon can not be notified. */
goto error_fatal;
}
- rcu_read_unlock();
-
- health_code_update();
/* This will issue a consumer stop. */
/* This will issue a consumer stop. */
+ ret = -1;
+ goto end;
+
+end:
+ rcu_read_unlock();
+ health_code_update();
+ return ret;