From 8d37b94824ee0e3eaa6775979c235a2305d1d7f9 Mon Sep 17 00:00:00 2001 From: des Date: Wed, 2 May 2007 14:37:42 +0000 Subject: [PATCH] Don't try to lock the objhead mutex if we don't have an objhead. Doing so caused the Varnish child to die immediately after sending its 503 response if the backend didn't respond. Reviewed by: phk git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1376 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_hash.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_hash.c b/varnish-cache/bin/varnishd/cache_hash.c index 56eee23c..b2bd45cc 100644 --- a/varnish-cache/bin/varnishd/cache_hash.c +++ b/varnish-cache/bin/varnishd/cache_hash.c @@ -185,6 +185,7 @@ HSH_Lookup(struct sess *sp) void HSH_Unbusy(struct object *o) { + struct objhead *oh; struct sess *sp; CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); @@ -192,9 +193,14 @@ HSH_Unbusy(struct object *o) assert(o->refcnt > 0); if (o->cacheable) EXP_Insert(o); - LOCK(&o->objhead->mtx); + oh = o->objhead; + if (oh != NULL) { + CHECK_OBJ(oh, OBJHEAD_MAGIC); + LOCK(&oh->mtx); + } o->busy = 0; - UNLOCK(&o->objhead->mtx); + if (oh != NULL) + UNLOCK(&oh->mtx); while (1) { sp = TAILQ_FIRST(&o->waitinglist); if (sp == NULL) -- 2.39.5