X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;fp=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=c7745abf1485d37f2e651ec8d37490adbb6b85a9;hp=73773bd137726c4f09cbd4508338f8b391ad8583;hb=5c5373c3cbfebddb0068fe13600766bb381048da;hpb=8790759cef081ff562cff2b493e20a6a085f4b21 diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 73773bd13..c7745abf1 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -4549,6 +4549,7 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd const char *trigger_name; uid_t trigger_owner; enum lttng_trigger_status trigger_status; + struct lttng_trigger *sessiond_trigger = NULL; trigger_status = lttng_trigger_get_name(trigger, &trigger_name); trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(unnamed)"; @@ -4576,6 +4577,28 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd } } + /* Fetch the sessiond side trigger object. */ + ret_code = notification_thread_command_get_trigger( + notification_thread, trigger, &sessiond_trigger); + if (ret_code != LTTNG_OK) { + DBG("Failed to get trigger from notification thread during unregister: trigger name = '%s', trigger owner uid = %d, error code = %d", + trigger_name, (int) trigger_owner, ret_code); + goto end; + } + + assert(sessiond_trigger); + + /* + * From this point on, no matter what, consider the trigger + * unregistered. + * + * We set the unregistered state of the sessiond side trigger object in + * the client thread since we want to minimize the possibility of the + * notification thread being stalled due to a long execution of an + * action that required the trigger lock. + */ + lttng_trigger_set_as_unregistered(sessiond_trigger); + ret_code = notification_thread_command_unregister_trigger(notification_thread, trigger); if (ret_code != LTTNG_OK) { @@ -4600,6 +4623,7 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd } end: + lttng_trigger_put(sessiond_trigger); return ret_code; }