Commit 9b7adba9 authored by Jens Axboe's avatar Jens Axboe

io_uring: add missing REQ_F_COMP_LOCKED for nested requests

When we traverse into failing links or timeouts, we need to ensure we
propagate the REQ_F_COMP_LOCKED flag to ensure that we correctly signal
to the completion side that we already hold the completion lock.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7271ef3a
...@@ -1609,6 +1609,7 @@ static bool __io_kill_linked_timeout(struct io_kiocb *req) ...@@ -1609,6 +1609,7 @@ static bool __io_kill_linked_timeout(struct io_kiocb *req)
return false; return false;
list_del_init(&link->link_list); list_del_init(&link->link_list);
link->flags |= REQ_F_COMP_LOCKED;
wake_ev = io_link_cancel_timeout(link); wake_ev = io_link_cancel_timeout(link);
req->flags &= ~REQ_F_LINK_TIMEOUT; req->flags &= ~REQ_F_LINK_TIMEOUT;
return wake_ev; return wake_ev;
...@@ -1667,6 +1668,7 @@ static void __io_fail_links(struct io_kiocb *req) ...@@ -1667,6 +1668,7 @@ static void __io_fail_links(struct io_kiocb *req)
trace_io_uring_fail_link(req, link); trace_io_uring_fail_link(req, link);
io_cqring_fill_event(link, -ECANCELED); io_cqring_fill_event(link, -ECANCELED);
link->flags |= REQ_F_COMP_LOCKED;
__io_double_put_req(link); __io_double_put_req(link);
req->flags &= ~REQ_F_LINK_TIMEOUT; req->flags &= ~REQ_F_LINK_TIMEOUT;
} }
...@@ -5071,6 +5073,7 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) ...@@ -5071,6 +5073,7 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data)
return -EALREADY; return -EALREADY;
req_set_fail_links(req); req_set_fail_links(req);
req->flags |= REQ_F_COMP_LOCKED;
io_cqring_fill_event(req, -ECANCELED); io_cqring_fill_event(req, -ECANCELED);
io_put_req(req); io_put_req(req);
return 0; return 0;
......
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