Commit f40b964a authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: clean up io_poll_task_func()

io_poll_complete() always fills an event (even an overflowed one), so we
always should do io_cqring_ev_posted() afterwards. And that's what is
currently happening, because second EPOLLONESHOT check is always true,
it can't return !done for oneshots.

Remove those branching, it's much easier to read.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e0051d7d
...@@ -4926,20 +4926,18 @@ static void io_poll_task_func(struct callback_head *cb) ...@@ -4926,20 +4926,18 @@ static void io_poll_task_func(struct callback_head *cb)
if (io_poll_rewait(req, &req->poll)) { if (io_poll_rewait(req, &req->poll)) {
spin_unlock_irq(&ctx->completion_lock); spin_unlock_irq(&ctx->completion_lock);
} else { } else {
bool done, post_ev; bool done;
post_ev = done = io_poll_complete(req, req->result, 0); done = io_poll_complete(req, req->result, 0);
if (done) { if (done) {
hash_del(&req->hash_node); hash_del(&req->hash_node);
} else if (!(req->poll.events & EPOLLONESHOT)) { } else {
post_ev = true;
req->result = 0; req->result = 0;
add_wait_queue(req->poll.head, &req->poll.wait); add_wait_queue(req->poll.head, &req->poll.wait);
} }
spin_unlock_irq(&ctx->completion_lock); spin_unlock_irq(&ctx->completion_lock);
io_cqring_ev_posted(ctx);
if (post_ev)
io_cqring_ev_posted(ctx);
if (done) { if (done) {
nxt = io_put_req_find_next(req); nxt = io_put_req_find_next(req);
if (nxt) if (nxt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment