io_uring: fix async accept on O_NONBLOCK sockets
authorDylan Yudaken <dylany@meta.com>
Sat, 21 Jan 2023 16:13:12 +0000 (09:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:22:44 +0000 (07:22 +0100)
commit30b90689344b9f357dcbf9532973c1e749438c1c
tree53822572d7d19e24aa59cce3d4bdce69075b3621
parenta79b13f24967b68b49aa23eda5fa9eb14d07b3a4
io_uring: fix async accept on O_NONBLOCK sockets

commit a73825ba70c93e1eb39a845bb3d9885a787f8ffe upstream.

Do not set REQ_F_NOWAIT if the socket is non blocking. When enabled this
causes the accept to immediately post a CQE with EAGAIN, which means you
cannot perform an accept SQE on a NONBLOCK socket asynchronously.

By removing the flag if there is no pending accept then poll is armed as
usual and when a connection comes in the CQE is posted.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220324143435.2875844-1-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/io_uring.c