X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng-sessiond%2Fmain.c;h=7d898a94e19938ebbe697ef686d3b3bef95d9091;hp=7e4000a0fd1183365a9ccc7746e47297f0cb9d66;hb=8535a6d9d5bebd85679008b795cce0545a4c4faf;hpb=35a9059d90ff33b4cfd57ad613969e333dba23a1 diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 7e4000a0f..7d898a94e 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -2191,6 +2191,12 @@ static int cmd_disable_channel(struct ltt_session *session, goto error; } + /* Already disabled */ + if (!uchan->enabled) { + DBG2("UST channel %s already disabled", channel_name); + break; + } + ret = ust_app_disable_channel_glb(usess, uchan); if (ret < 0) { ret = LTTCOMM_UST_DISABLE_FAIL; @@ -2299,28 +2305,32 @@ static int cmd_enable_channel(struct ltt_session *session, goto error; } - rcu_read_lock(); - hashtable_add_unique(usess->domain_global.channels, &uchan->node); - rcu_read_unlock(); - DBG2("UST channel %s added to global domain HT", attr->name); - /* Add channel to all registered applications */ ret = ust_app_create_channel_glb(usess, uchan); if (ret != 0) { ret = LTTCOMM_UST_CHAN_FAIL; goto error; } + + rcu_read_lock(); + hashtable_add_unique(usess->domain_global.channels, &uchan->node); + rcu_read_unlock(); + + DBG2("UST channel %s added to global domain HT", attr->name); } else { /* If already enabled, everything is OK */ if (uchan->enabled) { - ret = LTTCOMM_OK; - goto error; + break; } ret = ust_app_enable_channel_glb(usess, uchan); if (ret < 0) { - ret = LTTCOMM_UST_ENABLE_FAIL; - goto error; + if (ret != -EEXIST) { + ret = LTTCOMM_UST_CHAN_ENABLE_FAIL; + goto error; + } else { + ret = LTTCOMM_OK; + } } }