Skip to content
Snippets Groups Projects
Commit 03727b29 authored by Florian Fischer's avatar Florian Fischer
Browse files

[IoContext] invalidate unsubmitted sqes

io_uring_submit does some inline error checking and consumes less
cqes than prepared if an error is detected.

Currently we just cancel the Futures, whose prepared sqes were not submitted.
But this leaves already prepared sqes for those futures in the SQ
of the io_uring which will be submitted the next time io_uring_submit
is called.

This results in a violation of the chain guaranty, that dependent operations
are only executed if all dependencies were successful.
Additionally this leads to double completions or memory corruption
because the io_uring will produce cqes for already completed Futures.

To prevent this from happening we track all sqes we prepared to
invalidate and resubmit those which were not submitted because of a short submit.
We invalidate sqes by preparing them as NOP instructions and set their
user data to NULL.

I took this approach instead of rewinding the ring or somethings like
similar because it seemed safer for me not fiddle with io_uring internals
and just be less efficient.

Enable previously failing LinkFutureTest test cases.
parent 434ca2c5
No related branches found
No related tags found
No related merge requests found
Pipeline #59470 passed
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment