liburing
liburing copied to clipboard
Clarification on cancellation
The documentation on cancellation seems a little lacking.
- [ ] 1. How do
IORING_OP_ASYNC_CANCEL
andIORING_OP_LINK_TIMEOUT
affect the result of the target operation? - [x] 2. What is the effect of
IORING_OP_ASYNC_CANCEL
when there are multiple operations in flight with the specified user data? - [ ] 3. How is an
IORING_OP_LINK_TIMEOUT
operation affected by the successful cancellation viaIORING_OP_ASYNC_CANCEL
of the operation to which it is linked? - [ ] 4. What is the effect of
IORING_OP_LINK_TIMEOUT
on subsequent operations in a chain, after the successful completion of the operation to which it is linked?
I've actually wondered about these things myself.
Most specifically:
What is the effect of IORING_OP_ASYNC_CANCEL when there are multiple operations in flight with the specified user data?
An answer to this would be really appreciated.
It depends on if match all is set or not. If set, it'll match all of them and try to cancel them. If not, it'll match the first one it finds.
An area of note is cancelling a poll request.
Using IORING_OP_POLL_REMOVE
, the poll request returns, then the cancel request.
Using IORING_OP_ASYNC_CANCEL
, the cancel request returns, then the poll request.
(if I remember correctly, I may have the order mixed up)
I was wondering if this was intentional. I would guess that "async" means the request being cancelled finishes asynchronously so it returns after.
I suspect this is going to be an implementation detail, and subject to different states of the ring
I wouldnt make any assumptions on the ordering of completions for different requests