[master] b468fff Add an assert that segment rounding doesn't overstep our previous allocation calculations.

Martin Blix Grydeland martin at varnish-cache.org
Wed Oct 10 09:49:18 CEST 2012


commit b468fff3603182fd1f36f3d1ab21c50e90ce9c2f
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Sep 27 14:02:18 2012 +0200

    Add an assert that segment rounding doesn't overstep our previous
    allocation calculations.

diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c
index 7d68e48..7ca79d6 100644
--- a/bin/varnishd/storage/storage_persistent_silo.c
+++ b/bin/varnishd/storage/storage_persistent_silo.c
@@ -218,6 +218,7 @@ smp_new_seg(struct smp_sc *sc)
 
 	sg->p.offset = IRNUP(sc, sg->p.offset);
 	sg->p.length = IRNDN(sc, sg->p.length);
+	assert(sg->p.offset + sg->p.length <= tmpsg.p.offset + tmpsg.p.length);
 	sc->free_offset = sg->p.offset + sg->p.length;
 
 	VTAILQ_INSERT_TAIL(&sc->segments, sg, list);



More information about the varnish-commit mailing list