From nobody Sat Feb 10 09:33:59 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TX5Bv47Jvz59L7h; Sat, 10 Feb 2024 09:33:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TX5Bv3YkJz4ZKY; Sat, 10 Feb 2024 09:33:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707557639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xLQHwI1wtS2oygDPmfVPSeKeJoks8ladn6BCwLUVQHE=; b=MQ4XMgWmRLJ1lIAgQ8voqYPZXImt+kyn6W+B+ueRSoA0hcJEeqxcsLz1x+NNriSlEHy6D2 D8M7z8fSeLyJT/CYVUskcIMqwknp4HXwmMW1/jboKXrI3LaQvDHQnLGZDpFsZ7pJG+NWQ8 VX0X8J/VwjNnyIAliT/vttaM64XdXd6w39aWGz4R8neJsbXBuUCAgKGf3M73vDESjSdky8 ST7PYp37d9vBz4QQ/OzPYJPmfO5JVskLppNmFsLPDOX9CsYwWoy9biTemMBI9m1BPDDRCv tTfVAWnEDtt8sq+VhRlNYRQ+RXnVZzqfSPqVd46gXAf19FsmeqM78NjXTGHOYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707557639; a=rsa-sha256; cv=none; b=mR7zEZ/mP9lQnINqGvMXHhxZFbs0ls7tFqi4DbLkz9NGjAoNB3zrCAPp+g45vdaxsQ4knd 2dHQiJWNjN1xg0kPyuj/PyJBkNrnCqYRrgyEH60y2O2tPnWNpawSbwls0X3omA4W+ziq3D Y1ICuvCtxRZGHSBwyHAirDFCcm+ok00wZ0UFMGa3+VvAbLq/fQ7FdI1nh9XI0NHmV4RQII HwFf5t/1BBsVP6g8K8bIHRphGWpeK/1K0FrXtBQBii0hcy/npagbmRt3PNkVZvMSOyDk04 jDqlUr70XTHup/nG5IS79csu0WIR2L3CjCj++56rxbAAWlDlhKOZ2vCDmqdqug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707557639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xLQHwI1wtS2oygDPmfVPSeKeJoks8ladn6BCwLUVQHE=; b=gu9fHCIL2I5AU3PRHrqD+QbBmMtl+NhO5zsQsuNatHJRP+plWFfTJdXsiKNjnAfbO3zO5n e5TUbux8CGqzElqkqHf9aFH9wcyYMqOp9RPlR1D5xA0tcHd1rJ7LOJlPxslV2Vhlq+oZuI Rnnj3t/tlfbulCDYg15TMbozzZt739ddRdj2nIeOVk4DLBLOpntqgqomITkqBoK0+A7HPu ZLeFhrbu9omYPcJSD7J2hgZvhHD05tp8ztMYhTEwK8isTcF/4Xv3UYOl2aG2eIHpHF/1It L8Im3T1Td4G+QF4O70UuudmJQmDfF64cO2HQ+9pjgZGpTbiI6RjVwZW7lz3bcQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TX5Bv2bksz19vj; Sat, 10 Feb 2024 09:33:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41A9Xx9a044108; Sat, 10 Feb 2024 09:33:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41A9Xxf9044105; Sat, 10 Feb 2024 09:33:59 GMT (envelope-from git) Date: Sat, 10 Feb 2024 09:33:59 GMT Message-Id: <202402100933.41A9Xxf9044105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 3eeb22cb8194 - main - tcp: clean scoreboard when releasing the socket buffer List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3eeb22cb819409b49296ecb0acbd453671168313 Auto-Submitted: auto-generated The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=3eeb22cb819409b49296ecb0acbd453671168313 commit 3eeb22cb819409b49296ecb0acbd453671168313 Author: Richard Scheffenegger AuthorDate: 2024-02-10 09:16:08 +0000 Commit: Richard Scheffenegger CommitDate: 2024-02-10 09:20:00 +0000 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 --- sys/netinet/tcp_input.c | 1 + sys/netinet/tcp_subr.c | 5 ++--- sys/netinet/tcp_timewait.c | 1 + sys/netinet/tcp_usrreq.c | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index afcda60137ec..b3201750c1e6 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3022,6 +3022,7 @@ process_ACK: * 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 ? diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index be38280aef0a..6043a3d458e5 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -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; diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 328f8fe84a8c..266556274e18 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -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) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index ccd6a6149dae..a283d308801f 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -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) {