Re: [PATCH 1/2] io_uring/uring_cmd: copy SQE before issue_blocking punt

Caleb Sander Mateos <[email protected]>
Newsgroups org.kernel.vger.io-uring
Message-ID <CADUfDZqMpc5PCai9ZeUJQCJ++Cd3PszkDxyVu6WUMBKqwu1boQ@mail.gmail.com>
On Thu, Jul 2, 2026 at 1:41 AM Yang Xiuwei <[email protected]> wrote:
>
> io_uring_cmd_issue_blocking() punts to io-wq without copying the SQE
> off the submission queue, unlike the -EAGAIN and fallback paths. Copy
> the SQE into async data before queuing the work.

Add a Fixes tag?
Fixes: ecf47d452ced ("io_uring/uring_cmd: implement ->sqe_copy() to
avoid unnecessary copies")

>
> Signed-off-by: Yang Xiuwei <[email protected]>
> ---
>  io_uring/uring_cmd.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
> index 7b25dcd9d05f..fe32311b2e51 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -326,6 +326,10 @@ void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd)
>  {
>         struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
>
> +       if (!(req->flags & REQ_F_SQE_COPIED)) {
> +               io_uring_cmd_sqe_copy(req);
> +               req->flags |= REQ_F_SQE_COPIED;

Isn't this too late to copy the SQE? io_uring_cmd_issue_blocking() is
called from the blk_cmd_complete() task work, which is already
asynchronous with respect to the submission. So the kernel will
already returned the SQ slot to userspace.

Best,
Caleb

> +       }
>         io_req_queue_iowq(req);
>  }
>
> --
> 2.25.1
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.