Remove session list lock acquisition of the search
[lttng-tools.git] / ltt-sessiond / main.c
index 7532e2c3bdde96e18c6d82772bf2b9ae3fbb146c..d9c9d7b9a12923ab5c66c1eaff53ff6432c8cf69 100644 (file)
@@ -701,6 +701,12 @@ static void *thread_manage_kernel(void *data)
 
        while (1) {
                if (update_poll_flag == 1) {
+                       /*
+                        * Reset number of fd in the poll set. Always 2 since there is the thread
+                        * quit pipe and the kernel pipe.
+                        */
+                       events.nb_fd = 2;
+
                        ret = update_kernel_poll(&events);
                        if (ret < 0) {
                                goto error;
@@ -1432,12 +1438,13 @@ static int mount_debugfs(char *path)
 
        ret = mkdir_recursive(path, S_IRWXU | S_IRWXG, geteuid(), getegid());
        if (ret < 0) {
+               PERROR("Cannot create debugfs path");
                goto error;
        }
 
        ret = mount(type, path, type, 0, NULL);
        if (ret < 0) {
-               perror("mount debugfs");
+               PERROR("Cannot mount debugfs");
                goto error;
        }
 
@@ -1487,6 +1494,7 @@ static void init_kernel_tracer(void)
                }
                ret = mount_debugfs(debugfs_path);
                if (ret < 0) {
+                       perror("Cannot mount debugfs");
                        goto error;
                }
        }
@@ -1565,7 +1573,7 @@ static int create_ust_session(struct ltt_session *session,
                struct lttng_domain *domain)
 {
        int ret;
-       struct ltt_ust_session *lus;
+       struct ltt_ust_session *lus = NULL;
        struct ust_app *app;
 
        switch (domain->type) {
@@ -1577,6 +1585,7 @@ static int create_ust_session(struct ltt_session *session,
                }
                break;
        default:
+               ret = LTTCOMM_UNKNOWN_DOMAIN;
                goto error;
        }
 
@@ -2304,7 +2313,7 @@ static int cmd_destroy_session(struct ltt_session *session, char *name)
                perror("write kernel poll pipe");
        }
 
-       ret = session_destroy(name);
+       ret = session_destroy(session);
 
        return ret;
 }
@@ -2516,7 +2525,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx)
                break;
        default:
                DBG("Getting session %s by name", cmd_ctx->lsm->session.name);
+               session_lock_list();
                cmd_ctx->session = session_find_by_name(cmd_ctx->lsm->session.name);
+               session_unlock_list();
                if (cmd_ctx->session == NULL) {
                        if (cmd_ctx->lsm->session.name != NULL) {
                                ret = LTTCOMM_SESS_NOT_FOUND;
This page took 0.023865 seconds and 4 git commands to generate.