summaryrefslogtreecommitdiff
path: root/io_uring/poll.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-11-20 10:18:45 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-04 11:28:48 +0100
commitff46a46b7a30dd59513d7f33dfdd06553843b11d (patch)
tree72176b8dc098cee16b00c908770578c4349c313e /io_uring/poll.c
parent3b2728881dcd4ec3549d479c4b3aa38cf15fc73d (diff)
downloadlinux-ff46a46b7a30dd59513d7f33dfdd06553843b11d.tar.gz
linux-ff46a46b7a30dd59513d7f33dfdd06553843b11d.tar.bz2
linux-ff46a46b7a30dd59513d7f33dfdd06553843b11d.zip
io_uring: pass in EPOLL_URING_WAKE for eventfd signaling and wakeups
[ Upstream commit 4464853277d0ccdb9914608dd1332f0fa2f9846f ] Pass in EPOLL_URING_WAKE when signaling eventfd or doing poll related wakups, so that we can check for a circular event dependency between eventfd and epoll. If this flag is set when our wakeup handlers are called, then we know we have a dependency that needs to terminate multishot requests. eventfd and epoll are the only such possible dependencies. Cc: stable@vger.kernel.org # 6.0 Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'io_uring/poll.c')
-rw-r--r--io_uring/poll.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c
index d9bf1767867e..fded1445a803 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -429,6 +429,14 @@ static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
return 0;
if (io_poll_get_ownership(req)) {
+ /*
+ * If we trigger a multishot poll off our own wakeup path,
+ * disable multishot as there is a circular dependency between
+ * CQ posting and triggering the event.
+ */
+ if (mask & EPOLL_URING_WAKE)
+ poll->events |= EPOLLONESHOT;
+
/* optional, saves extra locking for removal in tw handler */
if (mask && poll->events & EPOLLONESHOT) {
list_del_init(&poll->wait.entry);