io_uring: cancelable uring_cmd
authorMing Lei <ming.lei@redhat.com>
Thu, 28 Sep 2023 12:43:25 +0000 (20:43 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 28 Sep 2023 13:36:00 +0000 (07:36 -0600)
commit93b8cc60c37b9d17732b7a297e5dca29b50a990d
tree69dc83ff4f33883707fc33fc30ad70cc40638969
parent528ce6781726e022bc5dc84034360e6e8f1b89bd
io_uring: cancelable uring_cmd

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.

Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Suggested-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/io_uring.h
include/linux/io_uring_types.h
io_uring/io_uring.c
io_uring/uring_cmd.c