Fix for saintmode

Artur Bergman artur at fastly.com
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.

https://raw.github.com/gist/1878965/b1b31dd188d524e8f56b4700da34f2233b125578/saintmode-sane


--- 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