Fix: Missing rcu_read_lock in save_domains()
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 18 Nov 2014 19:09:36 +0000 (14:09 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 18 Nov 2014 19:09:36 +0000 (14:09 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/save.c

index b78e7f78572b411dce5e4e7be66c75c4fccd5b91..c6fc33e7bb83c5b02b6fdc7c4c8b38517d5f9aea 100644 (file)
@@ -1225,6 +1225,8 @@ int save_domains(struct config_writer *writer, struct ltt_session *session)
        }
 
        if (session->ust_session) {
+               unsigned long agent_count;
+
                ret = config_writer_open_element(writer,
                        config_element_domain);
                if (ret) {
@@ -1243,30 +1245,37 @@ int save_domains(struct config_writer *writer, struct ltt_session *session)
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
-       }
 
-       if (session->ust_session &&
-                       lttng_ht_get_count(session->ust_session->agents) > 0) {
-               ret = config_writer_open_element(writer,
-                       config_element_domain);
-               if (ret) {
-                       ret = LTTNG_ERR_SAVE_IO_FAIL;
-                       goto end;
-               }
+               rcu_read_lock();
+               agent_count =
+                       lttng_ht_get_count(session->ust_session->agents);
+               rcu_read_unlock();
 
-               ret = save_ust_session(writer, session, 1);
-               if (ret) {
-                       goto end;
-               }
+               if (agent_count > 0) {
+                       ret = config_writer_open_element(writer,
+                               config_element_domain);
+                       if (ret) {
+                               ret = LTTNG_ERR_SAVE_IO_FAIL;
+                               goto end;
+                       }
 
-               /* /domain */
-               ret = config_writer_close_element(writer);
-               if (ret) {
-                       ret = LTTNG_ERR_SAVE_IO_FAIL;
-                       goto end;
+                       ret = save_ust_session(writer, session, 1);
+                       if (ret) {
+                               goto end;
+                       }
+
+                       /* /domain */
+                       ret = config_writer_close_element(writer);
+                       if (ret) {
+                               ret = LTTNG_ERR_SAVE_IO_FAIL;
+                               goto end;
+                       }
                }
        }
 
+       if (session->ust_session) {
+       }
+
        /* /domains */
        ret = config_writer_close_element(writer);
        if (ret) {
This page took 0.026702 seconds and 4 git commands to generate.