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
This commit is contained in:
Richard Scheffenegger 2021-04-02 20:26:48 +02:00
parent cad4fd0365
commit 38ea2bd069

View File

@ -644,7 +644,6 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
const int linesize = 128; const int linesize = 128;
struct sbuf sb; struct sbuf sb;
int i, error, len; int i, error, len;
bool do_drain = false;
struct hc_metrics *hc_entry; struct hc_metrics *hc_entry;
char ip4buf[INET_ADDRSTRLEN]; char ip4buf[INET_ADDRSTRLEN];
#ifdef INET6 #ifdef INET6
@ -702,15 +701,9 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
hc_entry->rmx_hits, hc_entry->rmx_hits,
hc_entry->rmx_updates, hc_entry->rmx_updates,
hc_entry->rmx_expire); hc_entry->rmx_expire);
do_drain = true;
} }
THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);
/* Need to track if sbuf has data, to avoid sbuf_drain(&sb);
* a KASSERT when calling sbuf_drain.
*/
if (do_drain) {
sbuf_drain(&sb);
do_drain = false;
} }
} }
#undef msec #undef msec