Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jan 2024 19:05:24 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c815844c5a60 - stable/14 - hpts: avoid duplicate call to tcp_output()
Message-ID:  <202401161905.40GJ5OR2010620@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=c815844c5a6037f138fbd531b3fa4d3859cab5d8

commit c815844c5a6037f138fbd531b3fa4d3859cab5d8
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2023-12-26 21:09:09 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-01-16 18:47:50 +0000

    hpts: avoid duplicate call to tcp_output()
    
    Obtained from:  rrs
    
    (cherry picked from commit 08c33cd94da18b4cae73a4837e13f677345a6c1e)
---
 sys/netinet/tcp_hpts.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c
index a6fa79a26949..73e9997c060f 100644
--- a/sys/netinet/tcp_hpts.c
+++ b/sys/netinet/tcp_hpts.c
@@ -1364,18 +1364,23 @@ again:
 			 * We also only call tfb_do_queued_segments() <or>
 			 * tcp_output().  It is expected that if segments are
 			 * queued and come in that the final input mbuf will
-			 * cause a call to output if it is needed.
+			 * cause a call to output if it is needed so we do
+			 * not need a second call to tcp_output(). So we do
+			 * one or the other but not both.
 			 */
 			tp->t_flags2 |= TF2_HPTS_CALLS;
 			if ((tp->t_flags2 & TF2_SUPPORTS_MBUFQ) &&
 			    !STAILQ_EMPTY(&tp->t_inqueue)) {
 				error = (*tp->t_fb->tfb_do_queued_segments)(tp, 0);
-				if (error) {
-					/* The input killed the connection */
+				/*
+				 * A non-zero return for input queue processing
+				 * is the lock is released and most likely the
+				 * inp is gone.
+				 */
+				if (error)
 					goto skip_pacing;
-				}
-			}
-			error = tcp_output(tp);
+			} else
+				error = tcp_output(tp);
 			if (error < 0)
 				goto skip_pacing;
 			INP_WUNLOCK(inp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401161905.40GJ5OR2010620>