BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alex Markuze" <amarkuze@redhat.com>
Cc: bpf@vger.kernel.org
Subject: Re: [RFC PATCH net-next 07/12] io_uring/opaque: add IORING_OP_OPAQUE_OBJ_SEND
Date: Wed, 11 Nov 2026 13:20:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-209064@kernel.org> (raw)
In-Reply-To: <20261110132006.3280986-8-amarkuze@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] io_uring/opaque: missing IO_URING_F_NONBLOCK check in
  io_opaque_send()
--

commit 1e659b6cd96d02ac2bb983ff5c26c204fe0a5ef3
Author: Alex Markuze <amarkuze@redhat.com>

io_uring/opaque: add IORING_OP_OPAQUE_OBJ_SEND

This commit adds the IORING_OP_OPAQUE_OBJ_SEND operation to send an optional
prefix, an opaque object range, and an optional suffix to a TCP socket with
per-socket FIFO ordering across the store.

> diff --git a/io_uring/opaque.c b/io_uring/opaque.c
> index 81fbf2011446d..b62c4be92fead 100644
> --- a/io_uring/opaque.c
> +++ b/io_uring/opaque.c

[ ... ]

> @@ -1591,9 +1669,858 @@ void io_opaque_cleanup(struct io_kiocb *req)

[ ... ]

> +sent:
> +	if (ret > 0) {
> +		if (body)
> +			op->iter = msg.msg_iter;
> +		op->progress += ret;
> +		if (op->progress < op->total_length && !iov_iter_count(&msg.msg_iter)) {
> +			/*
> +			 * TCP lets go of the socket while it waits for room, and a
> +			 * protocol may have taken it over by then: ask again.
> +			 */
> +			if (owned && !io_opaque_send_direct(sk)) {
> +				release_sock(sk);
> +				io_ring_submit_lock(req->ctx, issue_flags);
> +				owned = false;
> +			}
> +			goto again;
> +		}
> +		if (op->progress < op->total_length && !(req->flags & REQ_F_NOWAIT)) {
> +			ret = -EAGAIN;
> +			goto leave;
> +		}
> +	} else if (ret == -EAGAIN && (issue_flags & IO_URING_F_NONBLOCK) &&
> +		   !(req->flags & REQ_F_NOWAIT)) {
> +		goto leave;
> +	}

[Severity: Medium]
Should the partial-send check in io_opaque_send() also test
(issue_flags & IO_URING_F_NONBLOCK), matching the ret == -EAGAIN branch
right below it?

When io_opaque_send() runs in blocking mode from an io-wq worker
(!(issue_flags & IO_URING_F_NONBLOCK) and !(req->flags & REQ_F_NOWAIT)),
tcp_sendmsg_locked() or sock_sendmsg() can return a partial byte count if
sk_stream_wait_memory() is interrupted by a signal, cancellation, socket
error, or SO_SNDTIMEO after some bytes have already been queued.
Overwriting ret with -EAGAIN and jumping to leave skips the finish path's
io_opaque_tx_put() and io_opaque_send_unpin_cheap() before release_sock(),
and returns -EAGAIN to io_wq_submit_work() while needs_poll is false:

io_uring/io_uring.c:io_wq_submit_work() {
    ...
		if (!needs_poll) {
			if (!(req->flags & REQ_F_IOPOLL))
				break;
    ...
	if (ret)
		io_req_task_queue_fail(req, ret);
}

Because opaque stores require IORING_SETUP_DEFER_TASKRUN, the abandoned
head request stays at the head of tx->requests with tx->failed still false
and its object version pinned until the ring's submitter task runs
task_work cleanup.  Until then, queued followers are not canceled and new
sends to the same socket from other rings sharing the store can still pass
io_opaque_tx_join() and consume IORING_OPAQUE_SEND_LAST handles.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110132006.3280986-1-amarkuze@redhat.com?part=7

  reply	other threads:[~2026-11-11 13:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 13:19 [RFC PATCH net-next 00/12] io_uring: opaque TCP payload objects Alex Markuze
2026-11-10 13:19 ` [RFC PATCH net-next 01/12] net: add an exclusive TCP receive claim Alex Markuze
2026-11-11 13:20   ` sashiko-bot
2026-11-10 13:19 ` [RFC PATCH net-next 02/12] io_uring/opaque: add data structures and the UAPI header Alex Markuze
2026-11-10 13:19 ` [RFC PATCH net-next 03/12] io_uring/opaque: add backing accounting and immutable versions Alex Markuze
2026-11-11 13:20   ` sashiko-bot
2026-11-10 13:19 ` [RFC PATCH net-next 04/12] io_uring/opaque: add owned-page helpers for dense copies Alex Markuze
2026-11-10 13:19 ` [RFC PATCH net-next 05/12] io_uring/opaque: add store registration and IORING_OP_OPAQUE_OBJ Alex Markuze
2026-11-10 13:20 ` [RFC PATCH net-next 06/12] io_uring/opaque: allow rings to share a store Alex Markuze
2026-11-10 13:20 ` [RFC PATCH net-next 07/12] io_uring/opaque: add IORING_OP_OPAQUE_OBJ_SEND Alex Markuze
2026-11-11 13:20   ` sashiko-bot [this message]
2026-11-10 13:20 ` [RFC PATCH net-next 08/12] io_uring/opaque: add vectored IORING_OP_OPAQUE_OBJ_SEND Alex Markuze
2026-11-10 13:20 ` [RFC PATCH net-next 09/12] io_uring/opaque: add IORING_OP_OPAQUE_COLLECT Alex Markuze
2026-11-11 13:20   ` sashiko-bot
2026-11-10 13:20 ` [RFC PATCH net-next 10/12] io_uring/opaque: add IORING_OPAQUE_CREATE Alex Markuze
2026-11-11 13:20   ` sashiko-bot
2026-11-10 13:20 ` [RFC PATCH net-next 11/12] io_uring/opaque: add manual and automatic compaction Alex Markuze
2026-11-10 13:20 ` [RFC PATCH net-next 12/12] io_uring/opaque: add basic KUnit tests Alex Markuze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-209064@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amarkuze@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox