]> git.ipfire.org Git - thirdparty/linux.git/commit
ublk: complete command synchronously on error
authorCaleb Sander Mateos <csander@purestorage.com>
Tue, 25 Feb 2025 21:24:55 +0000 (14:24 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 3 Mar 2025 18:17:52 +0000 (11:17 -0700)
commit603f9be21c1894e462416e3324962d6c9c2b95f8
tree361b5aca7cf3f00badda52cce00b63471c5877f3
parent8ac17e6ae1bf4625b8fa457f135865c1fd86beae
ublk: complete command synchronously on error

In case of an error, ublk's ->uring_cmd() functions currently return
-EIOCBQUEUED and immediately call io_uring_cmd_done(). -EIOCBQUEUED and
io_uring_cmd_done() are intended for asynchronous completions. For
synchronous completions, the ->uring_cmd() function can just return the
negative return code directly. This skips io_uring_cmd_del_cancelable(),
and deferring the completion to task work. So return the error code
directly from __ublk_ch_uring_cmd() and ublk_ctrl_uring_cmd().

Update ublk_ch_uring_cmd_cb(), which currently ignores the return value
from __ublk_ch_uring_cmd(), to call io_uring_cmd_done() for synchronous
completions.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20250225212456.2902549-1-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c