io_uring cancellation
io_uring cancellation is a request to stop matching outstanding operations, with a result separate from each target operation's completion.
For a single user_data match with flags zero, the cancellation CQE reports 0 on success, -ENOENT when no target is found, or -EALREADY when immediate cancellation is no longer possible. A completed target and an incorrect identifier can both explain -ENOENT; inspect the target CQE. [1]
Use distinct target and cancellation identifiers; do not recycle the target identifier until its completion and all cancellation attempts targeting it are accounted for. [3] In Linux v6.14, a bulk counter can include running-work results, so it is not a completed-request ledger. [2]
Read/write payload buffers must remain valid until the target operation completes; submission stability does not shorten that lifetime. [5]
Relations
- related
- io-uring, io-uring-cqe, io-uring-linked-timeout, io-timeout
Advantages
- Makes cancellation an explicit operation whose result can be correlated with its target.
Limitations
- Cancellation is not rollback or persistence confirmation.
- The single-target result convention does not describe bulk cancellation counts.
Citations
- liburing 2.9: io_uring_prep_cancel(3), single-target results and completion handling.
- Linux v6.14: io_async_cancel_one and __io_async_cancel, including the bulk-count path.
- liburing 2.9: io_uring_cqe_get_data(3), application-supplied completion identity.
- liburing: io_uring(7), SQE pointer lifetimes and data stability; current manual reviewed 17 October 2026.