Fix: initialize syscall table when kernel tracer is lazily initialized
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index d5759b39180d1d789d7171ef6b5c68202ac03c01..936a8df9dc70d4dfd810c08a9296e6c2ca256d64 100644 (file)
@@ -2765,6 +2765,12 @@ static int init_kernel_tracer(void)
        }
 
        DBG("Kernel tracer fd %d", kernel_tracer_fd);
+
+       ret = syscall_init_table();
+       if (ret < 0) {
+               ERR("Unable to populate syscall table. Syscall tracing won't "
+                       "work for this session daemon.");
+       }
        return 0;
 
 error_version:
@@ -4441,8 +4447,17 @@ static void *thread_manage_clients(void *data)
                if (ret > 0 || (ret < 0 && errno != EINTR)) {
                        goto exit;
                }
-               cmm_smp_rmb();
        }
+       /*
+        * This barrier is paired with the one in sessiond_notify_ready() to
+        * ensure that loads accessing data initialized by the other threads,
+        * on which this thread was waiting, are not performed before this point.
+        *
+        * Note that this could be a 'read' memory barrier, but a full barrier
+        * is used in case the code changes. The performance implications of
+        * this choice are minimal since this is a slow path.
+        */
+       cmm_smp_mb();
 
        /* This testpoint is after we signal readiness to the parent. */
        if (testpoint(sessiond_thread_manage_clients)) {
@@ -4969,10 +4984,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                                "-l, --load");
                } else {
                        free(opt_load_session_path);
-                       opt_load_session_path = strdup(arg);
+                       opt_load_session_path = utils_expand_path(arg);
                        if (!opt_load_session_path) {
-                               PERROR("strdup");
-                               ret = -ENOMEM;
+                               ERR("Failed to expand load path %s", arg);
+                               ret = -EINVAL;
                        }
                }
        } else if (string_match(optname, "kmod-probes")) {
@@ -5971,14 +5986,6 @@ int main(int argc, char **argv)
                /* Setup kernel tracer */
                if (!opt_no_kernel) {
                        init_kernel_tracer();
-                       if (kernel_tracer_fd >= 0) {
-                               ret = syscall_init_table();
-                               if (ret < 0) {
-                                       ERR("Unable to populate syscall table. "
-                                               "Syscall tracing won't work "
-                                               "for this session daemon.");
-                               }
-                       }
                }
 
                /* Set ulimit for open files */
This page took 0.044123 seconds and 4 git commands to generate.