From 098d61830d68812c082329cd52df5b78498a27aa Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 2 Mar 2009 14:38:55 +0000 Subject: [PATCH] Clarify the waitinglist handling a little bit git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3857 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_hash.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_hash.c b/varnish-cache/bin/varnishd/cache_hash.c index 96fd47a4..caf6bf26 100644 --- a/varnish-cache/bin/varnishd/cache_hash.c +++ b/varnish-cache/bin/varnishd/cache_hash.c @@ -521,25 +521,23 @@ HSH_Unbusy(const struct sess *sp) CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); o = sp->obj; CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); + oh = o->objhead; + CHECK_OBJ(oh, OBJHEAD_MAGIC); + AN(ObjIsBusy(o)); assert(o->objcore->obj == o); assert(o->refcnt > 0); + assert(oh->refcnt > 0); if (o->ws_o->overflow) VSL_stats->n_objoverflow++; if (params->diag_bitmap & 0x40) WSP(sp, SLT_Debug, "Object %u workspace free %u", o->xid, WS_Free(o->ws_o)); - oh = o->objhead; - if (oh != NULL) { - CHECK_OBJ(oh, OBJHEAD_MAGIC); - Lck_Lock(&oh->mtx); - } + Lck_Lock(&oh->mtx); o->objcore->flags &= ~OC_F_BUSY; - if (oh != NULL) { - hsh_rush(oh); - Lck_Unlock(&oh->mtx); - } + hsh_rush(oh); + Lck_Unlock(&oh->mtx); } void @@ -605,9 +603,10 @@ HSH_Deref(const struct worker *w, struct object **oo) Lck_Lock(&oh->mtx); assert(o->refcnt > 0); r = --o->refcnt; - if (!r) + if (!r) { + assert(VTAILQ_EMPTY(&oh->waitinglist)); VTAILQ_REMOVE(&oh->objcs, oc, list); - else + } else hsh_rush(oh); Lck_Unlock(&oh->mtx); } -- 2.39.5