Skip to content

Commit

Permalink
ublk: honor IO_URING_F_NONBLOCK for handling control command
Browse files Browse the repository at this point in the history
Most of control command handlers may sleep, so return -EAGAIN in case
of IO_URING_F_NONBLOCK to defer the handling into io wq context.

Fixes: 71f28f3 ("ublk_drv: add io_uring based userspace block driver")
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230104133235.836536-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Ming Lei authored and Jens Axboe committed Jan 4, 2023
1 parent 9cea62b commit fa8e442
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/block/ublk_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,9 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,
struct ublksrv_ctrl_cmd *header = (struct ublksrv_ctrl_cmd *)cmd->cmd;
int ret = -EINVAL;

if (issue_flags & IO_URING_F_NONBLOCK)
return -EAGAIN;

ublk_ctrl_cmd_dump(cmd);

if (!(issue_flags & IO_URING_F_SQE128))
Expand Down

0 comments on commit fa8e442

Please sign in to comment.