[master] a6ddafc Clamp rather than overflow on child indexes when we get to the end of the UINT_MAX items we can support.

Poul-Henning Kamp phk at varnish-cache.org
Thu Aug 11 13:01:08 CEST 2011


commit a6ddafc0e87bcec71f016b8cae77b78641e617d7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Aug 11 10:59:34 2011 +0000

    Clamp rather than overflow on child indexes when we get to the
    end of the UINT_MAX items we can support.
    
    Found by adding a lot of asserts and brute force testing, both
    of which I have left in.
    
    Fixes 	#967
    
    May also be relevant to #827

diff --git a/bin/varnishd/cache_expire.c b/bin/varnishd/cache_expire.c
index 7822bf6..97e5734 100644
--- a/bin/varnishd/cache_expire.c
+++ b/bin/varnishd/cache_expire.c
@@ -182,6 +182,8 @@ exp_insert(struct objcore *oc, struct lru *lru)
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 	CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
 
+	Lck_AssertHeld(&lru->mtx);
+	Lck_AssertHeld(&exp_mtx);
 	assert(oc->timer_idx == BINHEAP_NOIDX);
 	binheap_insert(exp_heap, oc);
 	assert(oc->timer_idx != BINHEAP_NOIDX);



More information about the varnish-commit mailing list