"Poul-Henning Kamp" <[EMAIL PROTECTED]> writes:
> Obviously nobody else will ever check the busy flag in that case,
> so the locking isn't necessary.

HSH_Ref() and HSH_Deref() already check that o->objhead != NULL before
trying to lock the mutex, so I applied the same logic to HSH_Unbusy().
Is this a suitable fix?

DES
-- 
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no

Index: bin/varnishd/cache_hash.c
===================================================================
--- bin/varnishd/cache_hash.c   (revision 1373)
+++ bin/varnishd/cache_hash.c   (working copy)
@@ -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)
_______________________________________________
varnish-dev mailing list
[email protected]
http://projects.linpro.no/mailman/listinfo/varnish-dev

Reply via email to