tcp: clean scoreboard when releasing the socket buffer

The SACK scoreboard is conceptually an extention of the socket
buffer. Remove it when the socket buffer goes away with
soisdisconnected(). Verify that this is also the expected
state in tcp_discardcb().

PR:			276761
Reviewed by:		glebius, tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D43805
This commit is contained in:
Richard Scheffenegger
2024-02-10 10:16:08 +01:00
parent 89c3cc20d6
commit 3eeb22cb81
4 changed files with 5 additions and 3 deletions
+1
View File
@@ -3022,6 +3022,7 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th,
* we'll hang forever.
*/
if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
tcp_free_sackholes(tp);
soisdisconnected(so);
tcp_timer_activate(tp, TT_2MSL,
(tcp_fast_finwait2_recycle ?
+2 -3
View File
@@ -2383,6 +2383,7 @@ tcp_discardcb(struct tcpcb *tp)
#endif
INP_WLOCK_ASSERT(inp);
MPASS(TAILQ_EMPTY(&tp->snd_holes));
tcp_timer_stop(tp);
@@ -2394,9 +2395,6 @@ tcp_discardcb(struct tcpcb *tp)
if (tp->t_flags & TF_TOE)
tcp_offload_detach(tp);
#endif
tcp_free_sackholes(tp);
#ifdef TCPPCAP
/* Free the TCP PCAP queues. */
tcp_pcap_drain(&(tp->t_inpkts));
@@ -2531,6 +2529,7 @@ tcp_close(struct tcpcb *tp)
if (tp->t_state != TCPS_CLOSED)
tcp_state_change(tp, TCPS_CLOSED);
KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL"));
tcp_free_sackholes(tp);
soisdisconnected(so);
if (inp->inp_flags & INP_SOCKREF) {
inp->inp_flags &= ~INP_SOCKREF;
+1
View File
@@ -119,6 +119,7 @@ tcp_twstart(struct tcpcb *tp)
"(inp->inp_flags & INP_DROPPED) != 0"));
tcp_state_change(tp, TCPS_TIME_WAIT);
tcp_free_sackholes(tp);
soisdisconnected(inp->inp_socket);
if (tp->t_flags & TF_ACKNOW)
+1
View File
@@ -2777,6 +2777,7 @@ tcp_usrclosed(struct tcpcb *tp)
if (tp->t_acktime == 0)
tp->t_acktime = ticks;
if (tp->t_state >= TCPS_FIN_WAIT_2) {
tcp_free_sackholes(tp);
soisdisconnected(tptosocket(tp));
/* Prevent the connection hanging in FIN_WAIT_2 forever. */
if (tp->t_state == TCPS_FIN_WAIT_2) {