summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-04-09 09:13:19 +0100
committerJens Axboe <axboe@kernel.dk>2021-04-11 19:30:40 -0600
commitf40b964a66ace54cda811d8ba96eccec210cd7ad (patch)
treec7c863e295cf3bd202384f133e12746cab17de86 /fs/io_uring.c
parente0051d7d18e0b3e25195ab332beea1a1a2fba5ca (diff)
downloadlwn-f40b964a66ace54cda811d8ba96eccec210cd7ad.tar.gz
lwn-f40b964a66ace54cda811d8ba96eccec210cd7ad.zip
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: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 0fcb0f477d9e..33bb14313084 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4926,20 +4926,18 @@ static void io_poll_task_func(struct callback_head *cb)
if (io_poll_rewait(req, &req->poll)) {
spin_unlock_irq(&ctx->completion_lock);
} 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) {
hash_del(&req->hash_node);
- } else if (!(req->poll.events & EPOLLONESHOT)) {
- post_ev = true;
+ } else {
req->result = 0;
add_wait_queue(req->poll.head, &req->poll.wait);
}
spin_unlock_irq(&ctx->completion_lock);
+ io_cqring_ev_posted(ctx);
- if (post_ev)
- io_cqring_ev_posted(ctx);
if (done) {
nxt = io_put_req_find_next(req);
if (nxt)