[PATCH] splice: pass a poll key when waking pipe readers and writers

From: Breno Leitao

Date: Wed Sep 16 2026 - 04:38:59 EST


wakeup_pipe_readers() and wakeup_pipe_writers() wake the pipe wait queues
with a NULL key. ep_poll_callback() and pollwake() only filter on the
registered event mask when a key is supplied, so every epoll, poll() and
select() waiter on the pipe is woken, whether or not it asked for the
event that occurred.

anon_pipe_read() and anon_pipe_write() already pass EPOLLIN | EPOLLRDNORM
and EPOLLOUT | EPOLLWRNORM when waking the same wait queues. Do the same
here.

This is not visible in common pipe use: ordinary pipelines move data with
read()/write(), which already passes the key.

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
fs/splice.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 9d8f63e2fd1ab..c048183215343 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -179,7 +179,8 @@ static void wakeup_pipe_readers(struct pipe_inode_info *pipe)
{
smp_mb();
if (waitqueue_active(&pipe->rd_wait))
- wake_up_interruptible(&pipe->rd_wait);
+ wake_up_interruptible_poll(&pipe->rd_wait,
+ EPOLLIN | EPOLLRDNORM);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}

@@ -415,7 +416,8 @@ static void wakeup_pipe_writers(struct pipe_inode_info *pipe)
{
smp_mb();
if (waitqueue_active(&pipe->wr_wait))
- wake_up_interruptible(&pipe->wr_wait);
+ wake_up_interruptible_poll(&pipe->wr_wait,
+ EPOLLOUT | EPOLLWRNORM);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}


---
base-commit: 587858367581b9c55c3690f4e63382ad622719d4
change-id: 20260915-b4-splice-poll-key-bc7d5d0d0f68

Best regards,
--
Breno Leitao <leitao@xxxxxxxxxx>