* [PATCH] tcp_splice: fcntl(2) returns the size of the pipe, if F_SETPIPE_SZ succeeds
@ 2024-10-24 23:04 Stefano Brivio
2024-10-25 0:21 ` David Gibson
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Brivio @ 2024-10-24 23:04 UTC (permalink / raw)
To: passt-dev; +Cc: Paul Holzinger
Don't report bogus failures (with --trace) just because the return
value is not zero.
Link: https://github.com/containers/podman/issues/24219
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
tcp_splice.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tcp_splice.c b/tcp_splice.c
index f112cfe..93f8bce 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -320,7 +320,7 @@ static int tcp_splice_connect_finish(const struct ctx *c,
}
if (fcntl(conn->pipe[sidei][0], F_SETPIPE_SZ,
- c->tcp.pipe_size)) {
+ c->tcp.pipe_size) != (int)c->tcp.pipe_size) {
flow_trace(conn,
"cannot set %d->%d pipe size to %zu",
sidei, !sidei, c->tcp.pipe_size);
@@ -672,7 +672,7 @@ static void tcp_splice_pipe_refill(const struct ctx *c)
continue;
if (fcntl(splice_pipe_pool[i][0], F_SETPIPE_SZ,
- c->tcp.pipe_size)) {
+ c->tcp.pipe_size) != (int)c->tcp.pipe_size) {
trace("TCP (spliced): cannot set pool pipe size to %zu",
c->tcp.pipe_size);
}
--
@@ -320,7 +320,7 @@ static int tcp_splice_connect_finish(const struct ctx *c,
}
if (fcntl(conn->pipe[sidei][0], F_SETPIPE_SZ,
- c->tcp.pipe_size)) {
+ c->tcp.pipe_size) != (int)c->tcp.pipe_size) {
flow_trace(conn,
"cannot set %d->%d pipe size to %zu",
sidei, !sidei, c->tcp.pipe_size);
@@ -672,7 +672,7 @@ static void tcp_splice_pipe_refill(const struct ctx *c)
continue;
if (fcntl(splice_pipe_pool[i][0], F_SETPIPE_SZ,
- c->tcp.pipe_size)) {
+ c->tcp.pipe_size) != (int)c->tcp.pipe_size) {
trace("TCP (spliced): cannot set pool pipe size to %zu",
c->tcp.pipe_size);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp_splice: fcntl(2) returns the size of the pipe, if F_SETPIPE_SZ succeeds
2024-10-24 23:04 [PATCH] tcp_splice: fcntl(2) returns the size of the pipe, if F_SETPIPE_SZ succeeds Stefano Brivio
@ 2024-10-25 0:21 ` David Gibson
2024-10-25 7:52 ` Stefano Brivio
0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2024-10-25 0:21 UTC (permalink / raw)
To: Stefano Brivio; +Cc: passt-dev, Paul Holzinger
[-- Attachment #1: Type: text/plain, Size: 1750 bytes --]
On Fri, Oct 25, 2024 at 01:04:18AM +0200, Stefano Brivio wrote:
> Don't report bogus failures (with --trace) just because the return
> value is not zero.
>
> Link: https://github.com/containers/podman/issues/24219
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
I think this is technicall still not quite right, because F_SETPIPE_SZ
can return a value larger than the one requested. AFAICT we don't get
that just becauase the way we allocate pipe sizes and the way the
kernel does are in alignment.
But it suppresses a bogus error and doesn't do any harm so:
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> tcp_splice.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tcp_splice.c b/tcp_splice.c
> index f112cfe..93f8bce 100644
> --- a/tcp_splice.c
> +++ b/tcp_splice.c
> @@ -320,7 +320,7 @@ static int tcp_splice_connect_finish(const struct ctx *c,
> }
>
> if (fcntl(conn->pipe[sidei][0], F_SETPIPE_SZ,
> - c->tcp.pipe_size)) {
> + c->tcp.pipe_size) != (int)c->tcp.pipe_size) {
> flow_trace(conn,
> "cannot set %d->%d pipe size to %zu",
> sidei, !sidei, c->tcp.pipe_size);
> @@ -672,7 +672,7 @@ static void tcp_splice_pipe_refill(const struct ctx *c)
> continue;
>
> if (fcntl(splice_pipe_pool[i][0], F_SETPIPE_SZ,
> - c->tcp.pipe_size)) {
> + c->tcp.pipe_size) != (int)c->tcp.pipe_size) {
> trace("TCP (spliced): cannot set pool pipe size to %zu",
> c->tcp.pipe_size);
> }
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp_splice: fcntl(2) returns the size of the pipe, if F_SETPIPE_SZ succeeds
2024-10-25 0:21 ` David Gibson
@ 2024-10-25 7:52 ` Stefano Brivio
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Brivio @ 2024-10-25 7:52 UTC (permalink / raw)
To: David Gibson; +Cc: passt-dev, Paul Holzinger
On Fri, 25 Oct 2024 11:21:59 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> On Fri, Oct 25, 2024 at 01:04:18AM +0200, Stefano Brivio wrote:
> > Don't report bogus failures (with --trace) just because the return
> > value is not zero.
> >
> > Link: https://github.com/containers/podman/issues/24219
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
>
> I think this is technicall still not quite right, because F_SETPIPE_SZ
> can return a value larger than the one requested.
Right, that might happen, but I also thought that that would be
interesting enough for us to print, especially because we first probe
for a size that we can set at least for one pool of pipes.
If we get a bigger size than what we wanted to set, it's somewhat more
likely that we'd have issues setting the same size for other pipes.
--
Stefano
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-25 7:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-24 23:04 [PATCH] tcp_splice: fcntl(2) returns the size of the pipe, if F_SETPIPE_SZ succeeds Stefano Brivio
2024-10-25 0:21 ` David Gibson
2024-10-25 7:52 ` Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).