Fix: consumerd: only return readiness when health is ready
[lttng-tools.git] / src / bin / lttng-consumerd / health-consumerd.c
index 60808f37094d304480468875c5cde6b944599c9c..ad2b5245a849f769d295f5a51464c973f1145b5b 100644 (file)
@@ -119,8 +119,6 @@ int setup_health_path(void)
                        goto end;
                }
        } else {
-               static char *rundir;
-
                home_path = utils_get_home_dir();
                if (home_path == NULL) {
                        /* TODO: Add --socket PATH option */
@@ -129,16 +127,6 @@ int setup_health_path(void)
                        goto end;
                }
 
-               /*
-                * Create rundir from home path. This will create something like
-                * $HOME/.lttng
-                */
-               ret = asprintf(&rundir, DEFAULT_LTTNG_HOME_RUNDIR, home_path);
-               if (ret < 0) {
-                       ret = -ENOMEM;
-                       goto end;
-               }
-
                /* Set health check Unix path */
                if (strlen(health_unix_sock_path) != 0) {
                        goto end;
@@ -146,22 +134,21 @@ int setup_health_path(void)
                switch (type) {
                case LTTNG_CONSUMER_KERNEL:
                        snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK, rundir);
+                               DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK, home_path);
                        break;
                case LTTNG_CONSUMER64_UST:
                        snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK, rundir);
+                               DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK, home_path);
                        break;
                case LTTNG_CONSUMER32_UST:
                        snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK, rundir);
+                               DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK, home_path);
                        break;
                default:
                        ret = -EINVAL;
                        goto end;
                }
        }
-
 end:
        return ret;
 }
@@ -246,6 +233,10 @@ void *thread_manage_health(void *data)
                goto error;
        }
 
+       /* Perform prior memory accesses before decrementing ready */
+       cmm_smp_mb__before_uatomic_dec();
+       uatomic_dec(&lttng_consumer_ready);
+
        while (1) {
                DBG("Health check ready");
 
This page took 0.023868 seconds and 4 git commands to generate.