Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] vsock/test: flaky multishot receive test due to partial reads
--

commit 9ec49ee8a33c71acaaeb9095c84d90cff4a9c2d9
Author: David Carlier <[email protected]>

vsock/test: cover receive queue hints

This commit adds io_uring receive tests to verify the behavior of the
IORING_CQE_F_SOCK_NONEMPTY flag across several receive scenarios, including
partial receives, EOF, nonblocking empty receives, and multishot receives.

> diff --git a/tools/testing/vsock/vsock_uring_test.c 
> b/tools/testing/vsock/vsock_uring_test.c
> index 5c3078969659f..318e17bd28bc6 100644
> --- a/tools/testing/vsock/vsock_uring_test.c
> +++ b/tools/testing/vsock/vsock_uring_test.c
[ ... ]
> +static void test_stream_uring_inq_mshot_server(const struct test_opts *opts)
> +{
[ ... ]
> +     sqe = io_uring_get_sqe(&ctx.ring);
> +     io_uring_prep_recv_multishot(sqe, ctx.fd, NULL, 0, 0);
> +     sqe->flags |= IOSQE_BUFFER_SELECT;
> +     sqe->buf_group = HINT_BUF_GROUP;
> +
> +     if (io_uring_submit(&ctx.ring) != 1)
> +             error(1, errno, "io_uring_submit");
> +
> +     control_expectln("SENT");
> +
> +     /* The payload completion drains the queue and keeps the request
> +      * armed, so the hint must report the queue as empty.
> +      */
> +     if (io_uring_wait_cqe(&ctx.ring, &cqe))
> +             error(1, errno, "io_uring_wait_cqe");
> +
> +     expect_res(cqe->res, HINT_CHUNK_SIZE, "multishot payload");

[Severity: Medium]
Does submitting the multishot receive request before the data is fully
queued introduce a race condition that could cause flaky test failures? 

Since test_stream_uring_inq_mshot_server() operates on a SOCK_STREAM
socket, the transport does not preserve message boundaries and data can
arrive in fragments. If a fragment arrives before the entire payload is
queued, io_uring may post a CQE with a partial data length. This would
subsequently cause the strict assertion expecting exactly HINT_CHUNK_SIZE
to fail.

Could inq_wait_queued() be used here prior to submitting the request,
similar to the deterministic approach taken in the other tests in this
file?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to