Fix: perform statedump before replying to sessiond
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 3 Oct 2016 17:18:53 +0000 (13:18 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 3 Oct 2016 17:30:10 +0000 (13:30 -0400)
If a stop command immediately follows a start command, the consumer
daemon will stop event recording in the ring buffers shared memory
control structures before the sessiond sends further commands to the
application. Therefore, a stop-after-start may be performed concurrently
with the statedump, leading to have parts of the statedump being
missing. This case may always happen if an application exits during
statedump, but it is not expected to have incomplete statedump in the
stop-after-start use case.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ust-comm.c

index 335279fb2be77847530b2b5217aada0b7d9eab70..f6c1f9e9e8b7a53262d79284f4f5785872b258fe 100644 (file)
@@ -869,6 +869,21 @@ int handle_message(struct sock_info *sock_info,
                }
        }
        DBG("Return value: %d", lur.ret_val);
+
+       ust_unlock();
+
+       /*
+        * Performed delayed statedump operations outside of the UST
+        * lock. We need to take the dynamic loader lock before we take
+        * the UST lock internally within handle_pending_statedump().
+         */
+       handle_pending_statedump(sock_info);
+
+       if (ust_lock()) {
+               ret = -LTTNG_UST_ERR_EXITING;
+               goto error;
+       }
+
        ret = send_reply(sock, &lur);
        if (ret < 0) {
                DBG("error sending reply");
@@ -899,13 +914,6 @@ int handle_message(struct sock_info *sock_info,
 error:
        ust_unlock();
 
-       /*
-        * Performed delayed statedump operations outside of the UST
-        * lock. We need to take the dynamic loader lock before we take
-        * the UST lock internally within handle_pending_statedump().
-         */
-       handle_pending_statedump(sock_info);
-
        return ret;
 }
 
This page took 0.025478 seconds and 4 git commands to generate.