[experimental-ims] 6c51567 Enforce that oc_getobj() does not work on BUSY objcores.

Geoff Simmons geoff at varnish-cache.org
Fri Jul 8 11:47:49 CEST 2011


commit 6c51567a2724a8da62b3e2af8845e39aeb3d335f
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