summaryrefslogtreecommitdiff
path: root/io_uring/poll.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-06-17 11:48:00 +0300
committerJens Axboe <axboe@kernel.dk>2022-07-25 03:39:14 +0300
commitd245bca6375bccfd589a6a7d5007df28575bb626 (patch)
treece0fbcda110609810940ebd21bdebeb2d942513f /io_uring/poll.c
parentf09c8643f0fad0e287b9f737955276000fd76a5d (diff)
downloadlinux-d245bca6375bccfd589a6a7d5007df28575bb626.tar.xz
io_uring: don't expose io_fill_cqe_aux()
Deduplicate some code and add a helper for filling an aux CQE, locking and notification. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/b7c6557c8f9dc5c4cfb01292116c682a0ff61081.1655455613.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/poll.c')
-rw-r--r--io_uring/poll.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c
index 9ae2982aef7c..e0c181fe6264 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -214,23 +214,15 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked)
if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
__poll_t mask = mangle_poll(req->cqe.res &
req->apoll_events);
- bool filled;
-
- spin_lock(&ctx->completion_lock);
- filled = io_fill_cqe_aux(ctx, req->cqe.user_data,
- mask, IORING_CQE_F_MORE);
- io_commit_cqring(ctx);
- spin_unlock(&ctx->completion_lock);
- if (filled) {
- io_cqring_ev_posted(ctx);
- continue;
- }
- return -ECANCELED;
- }
- ret = io_poll_issue(req, locked);
- if (ret)
- return ret;
+ if (!io_post_aux_cqe(ctx, req->cqe.user_data,
+ mask, IORING_CQE_F_MORE))
+ return -ECANCELED;
+ } else {
+ ret = io_poll_issue(req, locked);
+ if (ret)
+ return ret;
+ }
/*
* Release all references, retry if someone tried to restart