[3.0] e3deca9 Enforce that oc_getobj() does not work on BUSY objcores.

Tollef Fog Heen tfheen at varnish-cache.org
Wed Aug 17 11:25:29 CEST 2011


commit e3deca91c38dd4c521bdf8110db23e00066b8479
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jun 27 11:12:42 2011 +0000

    Enforce that oc_getobj() does not work on BUSY objcores.

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 1d3db55..eb7077c 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -434,6 +434,7 @@ oc_getobj(struct worker *wrk, struct objcore *oc)
 {
 
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
+	AZ(oc->flags & OC_F_BUSY);
 	AN(oc->methods);
 	AN(oc->methods->getobj);
 	return (oc->methods->getobj(wrk, oc));
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 2a6dcc5..d5c5ebe 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -594,7 +594,6 @@ HSH_Unbusy(const struct sess *sp)
 
 	AssertObjBusy(o);
 	AN(oc->ban);
-	assert(oc_getobj(sp->wrk, oc) == o);
 	assert(oc->refcnt > 0);
 	assert(oh->refcnt > 0);
 	if (o->ws_o->overflow)
@@ -613,6 +612,7 @@ HSH_Unbusy(const struct sess *sp)
 	hsh_rush(oh);
 	AN(oc->ban);
 	Lck_Unlock(&oh->mtx);
+	assert(oc_getobj(sp->wrk, oc) == o);
 }
 
 void



More information about the varnish-commit mailing list