Skip to content

Commit 4cbc5e9

Browse files
isilenceSasha Levin
authored and
Sasha Levin
committedMar 26, 2024
io_uring: fix poll_remove stalled req completion
[ Upstream commit 5e3afe5 ] Taking the ctx lock is not enough to use the deferred request completion infrastructure, it'll get queued into the list but no one would expect it there, so it will sit there until next io_submit_flush_completions(). It's hard to care about the cancellation path, so complete it via tw. Fixes: ef7dfac ("io_uring/poll: serialize poll linked timer start with poll removal") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/c446740bc16858f8a2a8dcdce899812f21d15f23.1710514702.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 943c14e commit 4cbc5e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎io_uring/poll.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,6 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags)
981981
struct io_hash_bucket *bucket;
982982
struct io_kiocb *preq;
983983
int ret2, ret = 0;
984-
struct io_tw_state ts = { .locked = true };
985984

986985
io_ring_submit_lock(ctx, issue_flags);
987986
preq = io_poll_find(ctx, true, &cd, &ctx->cancel_table, &bucket);
@@ -1030,7 +1029,8 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags)
10301029

10311030
req_set_fail(preq);
10321031
io_req_set_res(preq, -ECANCELED, 0);
1033-
io_req_task_complete(preq, &ts);
1032+
preq->io_task_work.func = io_req_task_complete;
1033+
io_req_task_work_add(preq);
10341034
out:
10351035
io_ring_submit_unlock(ctx, issue_flags);
10361036
if (ret < 0) {

0 commit comments

Comments
 (0)