]> err.no Git - varnish/commitdiff
Don't try to lock the objhead mutex if we don't have an objhead. Doing so
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 2 May 2007 14:37:42 +0000 (14:37 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 2 May 2007 14:37:42 +0000 (14:37 +0000)
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

index 56eee23c633e364a4576d591ab49c43856ac7872..b2bd45cc45cc407e84291cd6d5a92d69c52cb83a 100644 (file)
@@ -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)