Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Apr 2021 18:28:40 GMT
From:      Richard Scheffenegger <rscheff@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 38ea2bd0698e - main - Use sbuf_drain unconditionally
Message-ID:  <202104021828.132ISe7r036633@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rscheff:

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

commit 38ea2bd0698e434ec531b97fa94b24db24e16629
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2021-04-02 18:26:48 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2021-04-02 18:27:46 +0000

    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
---
 sys/netinet/tcp_hostcache.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c
index a8c4b2b178cd..f8f01afb07d7 100644
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -644,7 +644,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
@@ -702,15 +701,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



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