]> git.ipfire.org Git - thirdparty/linux.git/commit
pipe_read: don't wake up the writer if the pipe is still full
authorOleg Nesterov <oleg@redhat.com>
Thu, 2 Jan 2025 14:07:15 +0000 (15:07 +0100)
committerChristian Brauner <brauner@kernel.org>
Sat, 4 Jan 2025 09:12:19 +0000 (10:12 +0100)
commitaaec5a95d59615523db03dd53c2052f0a87beea7
treec8cf207921c738061065f0b7f3669eeef7263362
parentd2fc0ed52a284a13a16c914bc83b0b8733f55a4a
pipe_read: don't wake up the writer if the pipe is still full

wake_up(pipe->wr_wait) makes no sense if pipe_full() is still true after
the reading, the writer sleeping in wait_event(wr_wait, pipe_writable())
will check the pipe_writable() == !pipe_full() condition and sleep again.

Only wake the writer if we actually released a pipe buf, and the pipe was
full before we did so.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: https://lore.kernel.org/all/20241229135737.GA3293@redhat.com/
Link: https://lore.kernel.org/r/20250102140715.GA7091@redhat.com
Reported-by: WangYuli <wangyuli@uniontech.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/pipe.c