From fbe81decbdcdfed4b4ff336fcec5fe6ad0dfbe65 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 19 Feb 2024 18:56:49 +1100 Subject: tcp, tcp_splice: Issue warnings if unable to refill socket pool Currently if tcp_sock_refill_pool() is unable to fill all the slots in the pool, it will silently exit. This might lead to a later attempt to get fds from the pool to fail at which point it will be harder to tell what originally went wrong. Instead add warnings if we're unable to refill any of the socket pools when requested. We have tcp_sock_refill_pool() return an error and report it in the callers, because those callers have more context allowing for a more useful message. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tcp_splice.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tcp_splice.c') diff --git a/tcp_splice.c b/tcp_splice.c index cc9745e..ee68029 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -710,10 +710,18 @@ static int tcp_sock_refill_ns(void *arg) ns_enter(c); - if (c->ifi4) - tcp_sock_refill_pool(c, ns_sock_pool4, AF_INET); - if (c->ifi6) - tcp_sock_refill_pool(c, ns_sock_pool6, AF_INET6); + if (c->ifi4) { + int rc = tcp_sock_refill_pool(c, ns_sock_pool4, AF_INET); + if (rc < 0) + warn("TCP: Error refilling IPv4 ns socket pool: %s", + strerror(-rc)); + } + if (c->ifi6) { + int rc = tcp_sock_refill_pool(c, ns_sock_pool6, AF_INET6); + if (rc < 0) + warn("TCP: Error refilling IPv6 ns socket pool: %s", + strerror(-rc)); + } return 0; } -- cgit v1.2.3