[experimental-ims] 27e1139 Move some asserts up in the code, to catch Kristians panic.

Geoff Simmons geoff at varnish-cache.org
Wed Aug 31 16:04:04 CEST 2011


commit 27e11399fa3ba0aaf448af18b1e4c44b69d73913
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Aug 24 09:10:47 2011 +0000

    Move some asserts up in the code, to catch Kristians panic.

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 0b5ad8e..44e60ad 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -1005,8 +1005,8 @@ AssertObjBusy(const struct object *o)
 }
 
 static inline void
-AssertObjPassOrBusy(const struct object *o)
+AssertObjCorePassOrBusy(const struct objcore *oc)
 {
-	if (o->objcore != NULL)
-		AN (o->objcore->flags & OC_F_BUSY);
+	if (oc != NULL)
+		AN (oc->flags & OC_F_BUSY);
 }
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 282acf0..775fdcd 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -578,6 +578,7 @@ cnt_fetch(struct sess *sp)
 			sp->step = STP_FETCHBODY;
 			return (0);
 		case VCL_RET_DELIVER:
+			AssertObjCorePassOrBusy(sp->objcore);
 			sp->step = STP_FETCHBODY;
 			return (0);
 		default:
@@ -817,6 +818,7 @@ cnt_fetchbody(struct sess *sp)
 		sp->wrk->do_stream = 0;
 
 	if (sp->wrk->do_stream) {
+		AssertObjCorePassOrBusy(sp->obj->objcore);
 		sp->step = STP_PREPRESP;
 		return (0);
 	}
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index 1063c6b..657392f 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -496,7 +496,7 @@ FetchBody(struct sess *sp)
 		sp->wrk->vfp = &vfp_nop;
 
 	AN(sp->director);
-	AssertObjPassOrBusy(sp->obj);
+	AssertObjCorePassOrBusy(sp->obj->objcore);
 
 	AZ(sp->wrk->vgz_rx);
 	AZ(VTAILQ_FIRST(&sp->obj->store));
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 39afde6..b070b38 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -588,7 +588,7 @@ HSH_Drop(struct sess *sp)
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	o = sp->obj;
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
-	AssertObjPassOrBusy(o);
+	AssertObjCorePassOrBusy(o->objcore);
 	o->exp.ttl = -1.;
 	if (o->objcore != NULL)		/* Pass has no objcore */
 		HSH_Unbusy(sp);
diff --git a/bin/varnishd/cache_panic.c b/bin/varnishd/cache_panic.c
index 9279029..ad02caa 100644
--- a/bin/varnishd/cache_panic.c
+++ b/bin/varnishd/cache_panic.c
@@ -57,7 +57,7 @@
  */
 
 static struct vsb vsps, *vsp;
-pthread_mutex_t panicstr_mtx = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t panicstr_mtx = PTHREAD_MUTEX_INITIALIZER;
 
 /*--------------------------------------------------------------------*/
 



More information about the varnish-commit mailing list