Re: [PATCH V4 2/2] io_uring: cancelable uring_cmd

Gabriel Krisman Bertazi
2023-09-25T15:55:23Z

Ming Lei <ming.lei@redhat.com> writes:

> uring_cmd may never complete, such as ublk, in which uring cmd isn't
> completed until one new block request is coming from ublk block device.
>
> Add cancelable uring_cmd to provide mechanism to driver for cancelling
> pending commands in its own way.
>
> Add API of io_uring_cmd_mark_cancelable() for driver to mark one command as
> cancelable, then io_uring will cancel this command in
> io_uring_cancel_generic(). ->uring_cmd() callback is reused for canceling
> command in driver's way, then driver gets notified with the cancelling
> from io_uring.
>
> Add API of io_uring_cmd_get_task() to help driver cancel handler
> deal with the canceling.

I think using ->uring_cmd() with IO_URING_F_CANCEL looks much
nicer. thanks for that.

Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>

--
Gabriel Krisman Bertazi