Fix for saintmode

Artur Bergman artur at
Tue Feb 21 22:10:17 CET 2012

Saintmode sadly locks on every request to vbe_healthy, this means if you do req.backend.healty you acquire the lock.

It does this even if the list is empty. Following patch fix this, it introduces a tiny race which I am happy to live with.

--- a/varnish-cache/bin/varnishd/cache_backend.c
+++ b/varnish-cache/bin/varnishd/cache_backend.c
@@ -266,7 +266,7 @@ vbe_Healthy(double now, uintptr_t target, struct backend *backend)
               threshold = backend->saintmode_threshold;

       /* Saintmode is disabled */
-       if (threshold == 0)
+       if (threshold == 0 || VTAILQ_EMPTY(&backend->troublelist))
               return (1);

       /* No need to test if we don't have an object head to test against.

More information about the varnish-dev mailing list