POSIX AIO cancellation
POSIX AIO cancellation attempts to stop requests associated with a submission descriptor, with individual outcomes recorded separately.
Batch result: AIO_NOTCANCELED means at least one targeted operation could not be canceled, not that none were canceled. AIO_ALLDONE reports completion without classifying success or failure. Inspect each original request with aio_error, then retrieve its return once with aio_return after termination. [1] [2]
Descriptor scope: glibc 2.39 groups requests by the submitted descriptor number. In the native control, canceling through a dup alias returned AIO_ALLDONE while the original descriptor's read remained pending. Shared open-file-description identity did not widen that lookup. [5] [7]
Lifetime: an expired aio_suspend wait does not cancel the request. A pending read still requires a valid control block and destination buffer; a shutdown path must account for the original operations and any notification activity. [4] [3]
Relations
Limitations
- Which operations can be canceled is implementation-defined.
- Logical file readback does not establish crash durability or rollback of earlier effects.
Citations
- POSIX.1-2024: aio_cancel, cancellation scope and batch return values.
- POSIX.1-2024: aio_return, terminal status and one-time retrieval.
- POSIX.1-2024: aio_read, control-block and buffer lifetime.
- POSIX.1-2024: aio_suspend, expired waits and EAGAIN.
- glibc-2.39: rt/aio_cancel.c, __aio_cancel and descriptor-number lookup.
- Hesela: six native POSIX AIO cancellation cases, observed results and environment.
- Hesela: POSIX AIO cancellation, frozen source, observations, tests and offline replay.
Further reading
Sources & caveats
- Six scenarios, three repetitions per GCC setting (O0/O2), 36 recorded executions on one Linux 6.8/glibc 2.39-0ubuntu8.9 host. Replays check those observations, not a larger device population. [7]
- The canceled file write was queued behind a pipe gate, not interrupted in hardware. The offline package includes raw observations, source hashes, verification code and a license. [8]