mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
ublk: move check for empty address field on command submission
In preparation for zoned storage support, move the check for empty `addr` field into the command handler case statement. Note that the check makes no sense for `UBLK_IO_NEED_GET_DATA` because the `addr` field must always be set for this command. Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20230804114610.179530-3-nmi@metaspace.dk Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
9d4ed6d462
commit
1a6e88b959
@ -1419,11 +1419,6 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
|
||||
^ (_IOC_NR(cmd_op) == UBLK_IO_NEED_GET_DATA))
|
||||
goto out;
|
||||
|
||||
if (ublk_support_user_copy(ubq) && ub_cmd->addr) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ublk_check_cmd_op(cmd_op);
|
||||
if (ret)
|
||||
goto out;
|
||||
@ -1450,6 +1445,10 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
|
||||
*/
|
||||
if (!ub_cmd->addr && !ublk_need_get_data(ubq))
|
||||
goto out;
|
||||
} else if (ub_cmd->addr) {
|
||||
/* User copy requires addr to be unset */
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ublk_fill_io_cmd(io, cmd, ub_cmd->addr);
|
||||
@ -1469,7 +1468,12 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
|
||||
if (!ub_cmd->addr && (!ublk_need_get_data(ubq) ||
|
||||
req_op(req) == REQ_OP_READ))
|
||||
goto out;
|
||||
} else if (ub_cmd->addr) {
|
||||
/* User copy requires addr to be unset */
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ublk_fill_io_cmd(io, cmd, ub_cmd->addr);
|
||||
ublk_commit_completion(ub, ub_cmd);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user