pipe: pass a poll key when waking writers after a resize

pipe_resize_ring() wakes pipe->wr_wait 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 write queue is
woken, whether or not it asked for the event that occurred.

The event is the one the comment above the wakeup already names: more room
for writers.  anon_pipe_write() passes EPOLLOUT | EPOLLWRNORM when waking
the same queue; do the same here.  Writers blocked in
wait_event_interruptible_exclusive() are unaffected, as
autoremove_wake_function() ignores the key.

Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260916-pipe-resize-poll-key-v1-1-0f8f04f7dd5e@debian.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
Breno Leitao 2026-09-16 08:57:14 -07:00 committed by Christian Brauner
parent 0129ac825a
commit b76721a82c
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -1433,7 +1433,7 @@ int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)
spin_unlock_irq(&pipe->rd_wait.lock);
/* This might have made more room for writers */
wake_up_interruptible(&pipe->wr_wait);
wake_up_interruptible_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM);
return 0;
}