r594 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Wed Aug 2 06:57:58 CEST 2006
Author: phk
Date: 2006-08-02 06:57:58 +0200 (Wed, 02 Aug 2006)
New Revision: 594
Modified:
trunk/varnish-cache/bin/varnishd/cache_hash.c
trunk/varnish-cache/bin/varnishd/hash_classic.c
Log:
More miniobj paranoia
Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-01 19:48:36 UTC (rev 593)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-02 04:57:58 UTC (rev 594)
@@ -162,8 +162,11 @@
{
struct objhead *oh;
+ CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
oh = o->objhead;
+ CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
AZ(pthread_mutex_lock(&oh->mtx));
+ assert(o->refcnt > 0);
o->refcnt++;
AZ(pthread_mutex_unlock(&oh->mtx));
}
@@ -175,10 +178,13 @@
struct storage *st, *stn;
unsigned r;
+ CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
oh = o->objhead;
+ CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
/* drop ref on object */
AZ(pthread_mutex_lock(&oh->mtx));
+ assert(o->refcnt > 0);
r = --o->refcnt;
if (!r)
TAILQ_REMOVE(&oh->objects, o, list);
@@ -193,6 +199,7 @@
}
TAILQ_FOREACH_SAFE(st, &o->store, list, stn) {
+ CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
TAILQ_REMOVE(&o->store, st, list);
st->stevedore->free(st);
}
Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-01 19:48:36 UTC (rev 593)
+++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-02 04:57:58 UTC (rev 594)
@@ -174,9 +174,11 @@
CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
CAST_OBJ_NOTNULL(he, oh->hashpriv, HCL_ENTRY_MAGIC);
+ assert(he->refcnt > 0);
+ assert(he->mtx < hcl_nmtx);
+ assert(he->hash < hcl_nhash);
mtx = he->mtx;
AZ(pthread_mutex_lock(&hcl_mutex[mtx]));
- assert(he->refcnt > 0);
if (--he->refcnt > 0) {
AZ(pthread_mutex_unlock(&hcl_mutex[mtx]));
return (1);
More information about the varnish-commit
mailing list