Commit ad692c9e3ea3 for kernel
commit ad692c9e3ea3a72659ae8e695bfb52cc104c5631
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon Nov 23 16:47:42 2026 -0800
eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE
An EPOLLEXCLUSIVE entry that wakes an epoll_wait()er returns 1, and
because it was queued as an exclusive waiter that stops the wakeup walk.
But nothing makes the epoll user consume the event: it may be killed,
time out, pick another ready fd, or just not read. Anything queued
behind the entry - a blocked pipe reader, an accept()er, a recv()er -
then sleeps with the event pending.
Queue it with WQ_FLAG_POLL_EXCLUSIVE instead: still only one epoll
instance is woken per wakeup, but real waiters are not skipped.
Reported-by: Mani Tofigh <mt4022@columbia.edu>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index b959af04772c..58c0cb845dc7 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1626,9 +1626,8 @@ static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead,
pwq->whead = whead;
pwq->base = epi;
if (epi->event.events & EPOLLEXCLUSIVE)
- add_wait_queue_exclusive(whead, &pwq->wait);
- else
- add_wait_queue(whead, &pwq->wait);
+ pwq->wait.flags |= WQ_FLAG_POLL_EXCLUSIVE;
+ add_wait_queue(whead, &pwq->wait);
pwq->next = epi->pwqlist;
epi->pwqlist = pwq;
}