[PATCH 0/2] pipe: change pipe_write() to never add a zero-sized buffer

From: Oleg Nesterov
Date: Sun Feb 09 2025 - 10:08:10 EST


Please review.

pipe_write() can insert the empty buffer and this looks very confusing
to me. Because it looks obviously unnecessary and complicates the code.

In fact this logic doesn't even look strictly correct. For example,
eat_empty_buffer() simply updates pipe->tail but (unlike pipe_read) it
doesn't wake the writers.

But is pipe_write() is the only possible source of buf->len == 0 ?
I am not 100% sure, fs/splice.c is very nontrivial, but it seems that
this code at least tries to not add a zero-sized buf into pipe->bufs.

Oleg.
---

fs/pipe.c | 47 ++++++++++-------------------------------------
fs/splice.c | 14 ++++++--------
include/linux/pipe_fs_i.h | 6 ++++++
3 files changed, 22 insertions(+), 45 deletions(-)