]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring/poll: attempt request issue after racy poll wakeup
authorJens Axboe <axboe@kernel.dk>
Sat, 14 Jan 2023 15:46:14 +0000 (08:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:33 +0000 (11:58 +0100)
commit59720f2856a1cec7789f613c466afbbd3cb39217
tree81678c2888e693e23ce14d84e064421eb616edda
parent1d2e79d909a74147fcae385c14baf10491b9309b
io_uring/poll: attempt request issue after racy poll wakeup

commit 49f9443564089e05d881d503e50e2a32bc01f87a upstream.

If we have multiple requests waiting on the same target poll waitqueue,
then it's quite possible to get a request triggered and get disappointed
in not being able to make any progress with it. If we race in doing so,
we'll potentially leave the poll request on the internal tables, but
removed from the waitqueue. That means that any subsequent trigger of
the poll waitqueue will not kick that request into action, causing an
application to potentially wait for completion of a request that will
never happen.

Fix this by adding a new poll return state, IOU_POLL_REISSUE. Rather
than have complicated logic for how to re-arm a given type of request,
just punt it for a reissue.

While in there, move the 'ret' variable to the only section where it
gets used. This avoids confusion the scope of it.

Cc: stable@vger.kernel.org
Fixes: 5f6d43fa5548 ("io_uring: single shot poll removal optimisation")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/poll.c