From: Geliang Tang <geliang@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
MPTCP Upstream <mptcp@lists.linux.dev>
Subject: Re: [PATCH mptcp-next] Squash to "selftests: mptcp: add splice io mode"
Date: Fri, 30 Jan 2026 21:46:30 +0800 [thread overview]
Message-ID: <e0ee5fe14cf45ac2af67b510ee0810c8a20da105.camel@kernel.org> (raw)
In-Reply-To: <20260130-mptcp-sft-no-ignore-splice-err-v1-1-af0a458b6ec8@kernel.org>
Hi Matt,
Thanks for this fix.
On Fri, 2026-01-30 at 11:17 +0100, Matthieu Baerts (NGI0) wrote:
> NIPA review assistant rightly spotted errors with splice() are
> simply...
> ignored! Technically, mptcp_connect.sh will check the integrity of
> the
> transfer, but still, that's clearly not a good practice!
>
> The different possible errors are now caught, printed, and reported
> to
> the caller.
>
> Link:
> https://netdev-ai.bots.linux.dev/ai-review.html?id=93466fc9-574b-45fc-996e-13a19a1490a9
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Looks good to me!
Reviewed-by: Geliang Tang <geliang@kernel.org>
> ---
> tools/testing/selftests/net/mptcp/mptcp_connect.c | 34
> +++++++++++++++++------
> 1 file changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index ff1a298d3469..34d8efe429a4 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -937,24 +937,40 @@ static int do_splice(const int infd, const int
> outfd, const size_t len,
> struct wstate *winfo)
> {
> int pipefd[2];
> - ssize_t bytes;
> + ssize_t in_bytes, out_bytes;
This line is longer than the previous one; their positions could be
swapped.
-Geliang
> int err;
>
> err = pipe(pipefd);
> - if (err)
> - return err;
> + if (err) {
> + perror("pipe");
> + return 2;
> + }
>
> - while ((bytes = splice(infd, NULL, pipefd[1], NULL,
> - len - winfo->total_len,
> - SPLICE_F_MOVE | SPLICE_F_MORE)) > 0)
> {
> - splice(pipefd[0], NULL, outfd, NULL, bytes,
> - SPLICE_F_MOVE | SPLICE_F_MORE);
> +again:
> + in_bytes = splice(infd, NULL, pipefd[1], NULL, len - winfo-
> >total_len,
> + SPLICE_F_MOVE | SPLICE_F_MORE);
> + if (in_bytes < 0) {
> + perror("splice in");
> + err = 3;
> + } else if (in_bytes > 0) {
> + out_bytes = splice(pipefd[0], NULL, outfd, NULL,
> in_bytes,
> + SPLICE_F_MOVE | SPLICE_F_MORE);
> + if (out_bytes < 0) {
> + perror("splice out");
> + err = 4;
> + } else if (in_bytes != out_bytes) {
> + fprintf(stderr, "Unexpected transfer: %zu vs
> %zu\n",
> + in_bytes, out_bytes);
> + err = 5;
> + } else {
> + goto again;
> + }
> }
>
> close(pipefd[0]);
> close(pipefd[1]);
>
> - return 0;
> + return err;
> }
>
> static int copyfd_io_splice(int infd, int peerfd, int outfd,
> unsigned int size,
>
> ---
> base-commit: 7d56f2ba4d372e9660633de02a01236209c9df8f
> change-id: 20260130-mptcp-sft-no-ignore-splice-err-a35a97c217db
>
> Best regards,
next prev parent reply other threads:[~2026-01-30 13:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 10:17 [PATCH mptcp-next] Squash to "selftests: mptcp: add splice io mode" Matthieu Baerts (NGI0)
2026-01-30 11:15 ` MPTCP CI
2026-01-30 13:46 ` Geliang Tang [this message]
2026-01-30 18:45 ` Matthieu Baerts
-- strict thread matches above, loose matches on Subject: below --
2026-01-30 10:43 Geliang Tang
2026-01-30 10:50 ` Matthieu Baerts
2026-01-30 13:56 ` Geliang Tang
2026-01-30 11:45 ` MPTCP CI
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=e0ee5fe14cf45ac2af67b510ee0810c8a20da105.camel@kernel.org \
--to=geliang@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@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