liburing icon indicating copy to clipboard operation
liburing copied to clipboard

Clarification on cancellation

Open vasama opened this issue 2 years ago • 4 comments

The documentation on cancellation seems a little lacking.

  • [ ] 1. How do IORING_OP_ASYNC_CANCEL and IORING_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 via IORING_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?

vasama avatar Nov 18 '22 16:11 vasama

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.

cmazakas avatar Dec 02 '22 16:12 cmazakas

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.

axboe avatar Dec 02 '22 16:12 axboe

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.

davidzeng0 avatar Dec 10 '22 00:12 davidzeng0

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

DylanZA avatar Dec 13 '22 11:12 DylanZA