Hi, One of the tricky parts of cancelations is work that is handled by io-wq, and the regular cancelation API is naturally async and just returns -EALREADY for work in that state. This means that the work cancelation has been started, but we don't know if it's done yet. With an async API for cancelation, we really can't do much better than that. This leaves the application canceling work to need to wait for a CQE from the original request. Add a way to do sync cancel, even for io-wq. Since this isn't a natural fit for an SQE based cancel, add it via io_uring_register(), adding a IORING_REGISTER_SYNC_CANCEL operation. If we get -EALREADY, we wait for completions to come in. When they do, we re-check. Once we get -ENOENT for a lookup that previously gave us -EALREADY, we know the targeted requests have been stopped. By utilizing the usual ctx->cq_wait to trigger a retry of the cancel operation, we avoid adding any kind of extra overhead to the normal completion path and tracking specific requests. This gives applications an easy way to cancel any kind of request, and know that buffers associated with them will not be touched by the kernel. This effectively returns ownership of the data back to the application. -- Jens Axboe