ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue
authorCaleb Sander Mateos <csander@purestorage.com>
Mon, 1 Dec 2025 21:41:44 +0000 (14:41 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 8 Dec 2025 20:32:30 +0000 (13:32 -0700)
commit87213b0d847cd300285b5545598e0548baeb5208
tree1c20faead1da51182d3e282885cb23e3c4b8cbaa
parent0f45353dd48037af61f70df3468d25ca46afe909
ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue

Handling most of the ublksrv_ctrl_cmd opcodes require locking a mutex,
so ublk_ctrl_uring_cmd() bails out with EAGAIN when called with the
IO_URING_F_NONBLOCK issue flag. However, several opcodes can be handled
without blocking:
- UBLK_CMD_GET_QUEUE_AFFINITY
- UBLK_CMD_GET_DEV_INFO
- UBLK_CMD_GET_DEV_INFO2
- UBLK_U_CMD_GET_FEATURES

Handle these opcodes synchronously instead of returning EAGAIN so
io_uring doesn't need to issue the command via the worker thread pool.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c