Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Apr 2021 21:32:30 GMT
From:      Richard Scheffenegger <rscheff@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5934587a3130 - stable/12 - tcp: Use sbuf_drain unconditionally
Message-ID:  <202104162132.13GLWU3i034026@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=5934587a3130c7058c14c19dc6b991a9b5dd3642

commit 5934587a3130c7058c14c19dc6b991a9b5dd3642
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2021-04-02 18:26:48 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
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);



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