Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions drivers/block/ublk_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3251,12 +3251,19 @@ static int __ublk_fetch(struct io_uring_cmd *cmd, struct ublk_device *ub,

WARN_ON_ONCE(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV);

ublk_fill_io_cmd(io, cmd);

if (ublk_dev_support_batch_io(ub))
if (ublk_dev_support_batch_io(ub)) {
WRITE_ONCE(io->task, NULL);
else
} else {
/*
* FETCH must come from a real userspace task, not a
* kworker is actually io_uring fallback workqueue.
*/
if (current->flags & (PF_KTHREAD | PF_WQ_WORKER))
return -EINVAL;
WRITE_ONCE(io->task, get_task_struct(current));
}

ublk_fill_io_cmd(io, cmd);

return 0;
}
Expand Down