From owner-dev-commits-src-branches@freebsd.org Fri Apr 16 21:32:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81AF55E1908; Fri, 16 Apr 2021 21:32:30 +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 4FMTvL2bMbz4t03; Fri, 16 Apr 2021 21:32:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 478E74598; Fri, 16 Apr 2021 21:32:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13GLWUgQ034027; Fri, 16 Apr 2021 21:32:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13GLWU3i034026; Fri, 16 Apr 2021 21:32:30 GMT (envelope-from git) Date: Fri, 16 Apr 2021 21:32:30 GMT Message-Id: <202104162132.13GLWU3i034026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 5934587a3130 - stable/12 - tcp: Use sbuf_drain unconditionally 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 5934587a3130c7058c14c19dc6b991a9b5dd3642 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Apr 2021 21:32:30 -0000 The branch stable/12 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=5934587a3130c7058c14c19dc6b991a9b5dd3642 commit 5934587a3130c7058c14c19dc6b991a9b5dd3642 Author: Richard Scheffenegger AuthorDate: 2021-04-02 18:26:48 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-16 20:54:58 +0000 tcp: Use sbuf_drain unconditionally After making sbuf_drain safe for external use, there is no need to protect the call. MFC after: 2 weeks Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29545 (cherry picked from commit 38ea2bd0698e434ec531b97fa94b24db24e16629) (cherry picked from commit a04906f0273fa6d80eb3ebf22b9b84e53e6b21e0) --- sys/netinet/tcp_hostcache.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 14b3a34fc606..a92a12109bc4 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -626,7 +626,6 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) const int linesize = 128; struct sbuf sb; int i, error, len; - bool do_drain = false; struct hc_metrics *hc_entry; char ip4buf[INET_ADDRSTRLEN]; #ifdef INET6 @@ -684,16 +683,9 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) hc_entry->rmx_hits, hc_entry->rmx_updates, hc_entry->rmx_expire); - do_drain = true; } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); - /* Need to track if sbuf has data, to avoid - * a KASSERT when calling sbuf_drain. - */ - if (do_drain) { - sbuf_drain(&sb); - do_drain = false; - } + sbuf_drain(&sb); } #undef msec error = sbuf_finish(&sb);