linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtracefs: Flush pipe data in tracefs_cpu_flush()
@ 2023-01-06  4:16 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2023-01-06  4:16 UTC (permalink / raw)
  To: Linux Trace Devel

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The flushing of the data read in the splice pipe was missing from
tracefs_cpu_flush(). It had a mysterious goto statement that went to the
next line?? Anyway, add the code to read the data still in the pipe.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-record.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index 428bec0dfe3d..459c346c6017 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -464,10 +464,13 @@ int tracefs_cpu_flush(struct tracefs_cpu *tcpu, void *buffer)
 	if (tcpu->buffered < 0)
 		tcpu->buffered = 0;
 
-	if (tcpu->buffered)
-		goto do_read;
+	if (tcpu->buffered) {
+		ret = read(tcpu->splice_pipe[0], buffer, tcpu->subbuf_size);
+		if (ret > 0)
+			tcpu->buffered -= ret;
+		return ret;
+	}
 
- do_read:
 	ret = read(tcpu->fd, buffer, tcpu->subbuf_size);
 	if (ret > 0 && tcpu->buffered)
 		tcpu->buffered -= ret;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-06  4:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06  4:16 [PATCH] libtracefs: Flush pipe data in tracefs_cpu_flush() Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).