]> git.baikalelectronics.ru Git - kernel.git/commit
ring-buffer: Allow splice to read previous partially read pages
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 27 Sep 2022 18:43:17 +0000 (14:43 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 27 Sep 2022 18:48:27 +0000 (14:48 -0400)
commit2a46fcd01ae9de4c3b5b89906d936b612a0c2565
tree7ea731be1b1b3f791b27cd5be52b32eded9c37ae
parent934953dda9b31cd644c7b33f74ec8fc1837b82bf
ring-buffer: Allow splice to read previous partially read pages

If a page is partially read, and then the splice system call is run
against the ring buffer, it will always fail to read, no matter how much
is in the ring buffer. That's because the code path for a partial read of
the page does will fail if the "full" flag is set.

The splice system call wants full pages, so if the read of the ring buffer
is not yet full, it should return zero, and the splice will block. But if
a previous read was done, where the beginning has been consumed, it should
still be given to the splice caller if the rest of the page has been
written to.

This caused the splice command to never consume data in this scenario, and
let the ring buffer just fill up and lose events.

Link: https://lkml.kernel.org/r/20220927144317.46be6b80@gandalf.local.home
Cc: stable@vger.kernel.org
Fixes: 29711b6a37032 ("ring-buffer: read page interface")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c