Fix for 5.2-BETA lockup problems

Andre Oppermann andre at freebsd.org
Thu Nov 27 14:48:18 PST 2003


Hello all,

I've found what probably is going wrong in tcp_hostcache.  The problem is me
cutting corners (what goes around comes around...) in tcp_hc_insert when the
bucket limit is reached.  I made the #if 0 too big and the bucket was not
removed from the tailqueue when we hit the bucket limit.  A couple of lines
later it is inserted again as head element which leads to an infinite loop
either when the next lookup on the same bucket row is done, or when the
the tcp_hc_purge function is run to timeout the entries.

Please try the attached patch which should fix it.

-- 
Andre


Index: tcp_hostcache.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/tcp_hostcache.c,v
retrieving revision 1.1
diff -u -p -r1.1 tcp_hostcache.c
--- tcp_hostcache.c     20 Nov 2003 20:07:38 -0000      1.1
+++ tcp_hostcache.c     27 Nov 2003 20:23:06 -0000
@@ -354,11 +354,11 @@ tcp_hc_insert(struct in_conninfo *inc)
                 * maybe we drop something that is still "in-use" but we can
                 * be "lossy".
                 */
-#if 0
                TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q);
-               uma_zfree(tcp_hostcache.zone, hc_entry);
                tcp_hostcache.hashbase[hash].hch_length--;
                tcp_hostcache.cache_count--;
+#if 0
+               uma_zfree(tcp_hostcache.zone, hc_entry);
 #endif
                tcpstat.tcps_hc_bucketoverflow++;
        } else {


More information about the freebsd-current mailing list