io_uring: add support for IORING_ASYNC_CANCEL_ALL

The current cancelation will lookup and cancel the first request it
finds based on the key passed in. Add a flag that allows to cancel any
request that matches they key. It completes with the number of requests
found and canceled, or res < 0 if an error occured.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20220418164402.75259-4-axboe@kernel.dk
This commit is contained in:
Jens Axboe
2022-04-18 10:44:00 -06:00
parent b21432b4d5
commit 8e29da69fe
3 changed files with 78 additions and 21 deletions

View File

@@ -187,6 +187,13 @@ enum {
#define IORING_POLL_UPDATE_EVENTS (1U << 1)
#define IORING_POLL_UPDATE_USER_DATA (1U << 2)
/*
* ASYNC_CANCEL flags.
*
* IORING_ASYNC_CANCEL_ALL Cancel all requests that match the given key
*/
#define IORING_ASYNC_CANCEL_ALL (1U << 0)
/*
* IO completion data structure (Completion Queue Entry)
*/