r4492 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Jan 25 23:48:43 CET 2010


Author: phk
Date: 2010-01-25 23:48:42 +0100 (Mon, 25 Jan 2010)
New Revision: 4492

Modified:
   trunk/varnish-cache/bin/varnishd/cache_expire.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/storage_persistent.c
Log:
Be even more paranoid about oc->objhead pointers.



Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2010-01-25 22:23:31 UTC (rev 4491)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2010-01-25 22:48:42 UTC (rev 4492)
@@ -306,6 +306,8 @@
 			sp->objhead = oc->objhead;
 			sp->objcore = oc;
 			HSH_DerefObjCore(sp);
+			AZ(sp->objcore);
+			AZ(sp->objhead);
 			sp->wrk->stats.n_vampireobject--;
 		}
 	}

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-01-25 22:23:31 UTC (rev 4491)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-01-25 22:48:42 UTC (rev 4492)
@@ -547,14 +547,15 @@
 	sp->objcore = NULL;
 
 	Lck_Lock(&oh->mtx);
+	assert(oc->objhead == oh);
 	VTAILQ_REMOVE(&oh->objcs, oc, list);
 	Lck_Unlock(&oh->mtx);
+	oc->objhead = NULL;
 	assert(oh->refcnt > 0);
 	FREE_OBJ(oc);
 	sp->wrk->stats.n_objectcore--;
-	if (hash->deref(oh))
-		return;
-	HSH_DeleteObjHead(sp->wrk, oh);
+	if (!hash->deref(oh))
+		HSH_DeleteObjHead(sp->wrk, oh);
 }
 
 /*******************************************************************

Modified: trunk/varnish-cache/bin/varnishd/storage_persistent.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_persistent.c	2010-01-25 22:23:31 UTC (rev 4491)
+++ trunk/varnish-cache/bin/varnishd/storage_persistent.c	2010-01-25 22:48:42 UTC (rev 4492)
@@ -674,7 +674,6 @@
 	/* refcnt is one because the object is in the hash */
 	oc->obj->refcnt = 1;
 	oc->obj->objcore = oc;
-	oc->objhead = oh;
 	oc->obj->ban = oc->ban;
 
 	sg->nfixed++;



More information about the varnish-commit mailing list