Mailing List Archive

r1376 - trunk/varnish-cache/bin/varnishd
Author: des
Date: 2007-05-02 16:37:42 +0200 (Wed, 02 May 2007)
New Revision: 1376

Modified:
trunk/varnish-cache/bin/varnishd/cache_hash.c
Log:
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


Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2007-05-02 13:56:24 UTC (rev 1375)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2007-05-02 14:37:42 UTC (rev 1376)
@@ -185,6 +185,7 @@
void
HSH_Unbusy(struct object *o)
{
+ struct objhead *oh;
struct sess *sp;

CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
@@ -192,9 +193,14 @@
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)