Skip to content

Extend cancelation support

Jens Axboe io-uring 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 1 replyApplied
  2. v34 patches 0 repliesSuperseded
  3. v15 patches 0 repliesSuperseded

Changes in v4 from the cover letter

- Minor cleanups
- Rebase on current tree
- Add IORING_ASYNC_CANCEL_ANY

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/5io_uring: remove dead 'poll_only' argument to io_poll_cancel()fs/io_uring.c+3 -41 reply
2/5io_uring: pass in struct io_cancel_data consistentlyfs/io_uring.c+44 -320 replies
3/5io_uring: add support for IORING_ASYNC_CANCEL_ALLfs/io-wq.h fs/io_uring.c include/uapi/linux/io_uring.h+78 -210 replies
4/5io_uring: allow IORING_OP_ASYNC_CANCEL with 'fd' keyfs/io_uring.c include/uapi/linux/io_uring.h+66 -90 replies
5/5io_uring: add support for IORING_ASYNC_CANCEL_ANYfs/io_uring.c include/uapi/linux/io_uring.h+27 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCHSET v4 next 0/5] Extend cancelation support

Hi,

We currently only support looking up and canceling requests based on the user_data of the original request. Sometimes it can be useful to instead key off the fd used in the original request, eg if a socket goes away.

Patch 1 is just a cleanup spotted while doing this, 2 is a prep patch, patch 3 adds support for IORING_ASYNC_CANCEL_ALL, patch 4 adds support for IORING_ASYNC_CANCEL_FD, and patch 5 adds support for matching any request (useful with CANCEL_ALL).

If IORING_ASYNC_CANCEL_ALL is set, all requests matching the given criteria are canceled. Return value is number of requests canceled, and 0 if none were found, or any error encountered canceling requests.

If IORING_ASYNC_CANCEL_FD is set, requests matching sqe->fd are canceled rather than matching on sqe->addr for user_data.

If IORING_ASYNC_CANCEL_ANY is set, all requests are matched vs using the fd or user_data key.

There's some support in the below liburing branch:

https://git.kernel.dk/cgit/liburing/log/?h=cancel-fd-all

which also has various test cases.

v4:
- Minor cleanups
- Rebase on current tree
- Add IORING_ASYNC_CANCEL_ANY

Signature · 1 line
Jens Axboe