r3798 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Feb 20 19:00:06 CET 2009


Author: phk
Date: 2009-02-20 19:00:06 +0100 (Fri, 20 Feb 2009)
New Revision: 3798

Modified:
   trunk/varnish-cache/bin/varnishd/cache_expire.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
Add a lot more paranoia asserts



Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2009-02-20 17:21:30 UTC (rev 3797)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2009-02-20 18:00:06 UTC (rev 3798)
@@ -251,6 +251,7 @@
 
 		o = oc->obj;
 		CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+		CHECK_OBJ_NOTNULL(o->objhead, OBJHEAD_MAGIC);
 		assert(oc->timer_idx != BINHEAP_NOIDX);
 		binheap_delete(exp_heap, oc->timer_idx);
 		assert(oc->timer_idx == BINHEAP_NOIDX);

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2009-02-20 17:21:30 UTC (rev 3797)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2009-02-20 18:00:06 UTC (rev 3798)
@@ -356,6 +356,7 @@
 			WSP(sp, SLT_Debug,
 				"on waiting list <%s>", oh->hash);
 		sp->objhead = oh;
+		sp->wrk = NULL;
 		Lck_Unlock(&oh->mtx);
 		return (NULL);
 	}
@@ -393,10 +394,14 @@
 	unsigned u;
 	struct sess *sp;
 
+	CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
+	Lck_AssertHeld(&oh->mtx);
 	for (u = 0; u < params->rush_exponent; u++) {
 		sp = VTAILQ_FIRST(&oh->waitinglist);
 		if (sp == NULL)
 			return;
+		CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+		AZ(sp->wrk);
 		VTAILQ_REMOVE(&oh->waitinglist, sp, list);
 		DSL(0x20, SLT_Debug, sp->id, "off waiting list");
 		WRK_QueueSession(sp);

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2009-02-20 17:21:30 UTC (rev 3797)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2009-02-20 18:00:06 UTC (rev 3798)
@@ -330,10 +330,8 @@
 				w->lastused = TIM_real();
 			VTAILQ_INSERT_HEAD(&qp->idle, w, list);
 			if (!stats_clean) {
-				Lck_Lock(&wstat_mtx);
-				wrk_sumstat(w);
+				WRK_SumStat(w);
 				stats_clean = 1;
-				Lck_Unlock(&wstat_mtx);
 			}
 			Lck_CondWait(&w->cond, &qp->mtx);
 		}
@@ -348,6 +346,7 @@
 		AZ(w->wfd);
 		assert(w->wlp == w->wlb);
 		w->wrq = NULL;
+		HSH_Cleanup(w);
 		if (!Lck_Trylock(&wstat_mtx)) {
 			wrk_sumstat(w);
 			stats_clean = 1;
@@ -430,6 +429,7 @@
 	struct sess *sess;
 
 	CAST_OBJ_NOTNULL(sess, priv, SESS_MAGIC);
+	AZ(sess->wrk);
 	THR_SetSession(sess);
 	sess->wrk = w;
 	CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC);
@@ -445,6 +445,8 @@
 void
 WRK_QueueSession(struct sess *sp)
 {
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	AZ(sp->wrk);
 	sp->workreq.func = wrk_do_cnt_sess;
 	sp->workreq.priv = sp;
 	if (WRK_Queue(&sp->workreq) == 0)



More information about the varnish-commit mailing list