summaryrefslogtreecommitdiff
path: root/io_uring/poll.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-07-07 17:13:16 +0300
committerJens Axboe <axboe@kernel.dk>2022-07-25 03:39:17 +0300
commitb21a51e26e9aed66159c2c18651da22d585d2998 (patch)
treef3e46e18d5f03728097698e71a5f76abcbb168f1 /io_uring/poll.c
parentceff501790a9789c748a9b851f30f4f7e2fe4d72 (diff)
downloadlinux-b21a51e26e9aed66159c2c18651da22d585d2998.tar.xz
io_uring: clear REQ_F_HASH_LOCKED on hash removal
Instead of clearing REQ_F_HASH_LOCKED while arming a poll, unset the bit when we're removing the entry from the table in io_poll_tw_hash_eject(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/02e48bb88d6f1480c94ac2924c43ad1fbd48e92a.1657203020.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.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c
index c1359d45a396..77b669b06046 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -132,6 +132,7 @@ static void io_poll_tw_hash_eject(struct io_kiocb *req, bool *locked)
*/
io_tw_lock(ctx, locked);
hash_del(&req->hash_node);
+ req->flags &= ~REQ_F_HASH_LOCKED;
} else {
io_poll_req_delete(req, ctx);
}
@@ -617,9 +618,7 @@ int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
* apoll requests already grab the mutex to complete in the tw handler,
* so removal from the mutex-backed hash is free, use it by default.
*/
- if (issue_flags & IO_URING_F_UNLOCKED)
- req->flags &= ~REQ_F_HASH_LOCKED;
- else
+ if (!(issue_flags & IO_URING_F_UNLOCKED))
req->flags |= REQ_F_HASH_LOCKED;
if (!def->pollin && !def->pollout)
@@ -880,8 +879,6 @@ int io_poll_add(struct io_kiocb *req, unsigned int issue_flags)
if (!(issue_flags & IO_URING_F_UNLOCKED) &&
(req->ctx->flags & (IORING_SETUP_SQPOLL | IORING_SETUP_SINGLE_ISSUER)))
req->flags |= REQ_F_HASH_LOCKED;
- else
- req->flags &= ~REQ_F_HASH_LOCKED;
ret = __io_arm_poll_handler(req, poll, &ipt, poll->events, issue_flags);
if (ret > 0) {