The branch main has been updated by rscheff:

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

commit 38ea2bd0698e434ec531b97fa94b24db24e16629
Author:     Richard Scheffenegger <[email protected]>
AuthorDate: 2021-04-02 18:26:48 +0000
Commit:     Richard Scheffenegger <[email protected]>
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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to