Fix: use "flush empty" ioctl for snapshots
[lttng-tools.git] / src / common / kernel-consumer / kernel-consumer.c
index d9c4d2685f6cc7e1da9a6c0ccac0b0a56757ace3..57656dcc8794891dd81e8120330353b398bf6a19 100644 (file)
@@ -188,11 +188,20 @@ int lttng_kconsumer_snapshot_channel(uint64_t key, char *path,
                        channel->streams_sent_to_relayd = true;
                }
 
-               ret = kernctl_buffer_flush(stream->wait_fd);
+               ret = kernctl_buffer_flush_empty(stream->wait_fd);
                if (ret < 0) {
-                       ERR("Failed to flush kernel stream");
-                       ret = -errno;
-                       goto end_unlock;
+                       /*
+                        * Doing a buffer flush which does not take into
+                        * account empty packets. This is not perfect
+                        * for stream intersection, but required as a
+                        * fall-back when "flush_empty" is not
+                        * implemented by lttng-modules.
+                        */
+                       ret = kernctl_buffer_flush(stream->wait_fd);
+                       if (ret < 0) {
+                               ERR("Failed to flush kernel stream");
+                               goto end_unlock;
+                       }
                }
 
                ret = lttng_kconsumer_take_snapshot(stream);
This page took 0.024095 seconds and 4 git commands to generate.