[master] 96e2a95 Avoid taking the saintmode lock if the list empty.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Feb 27 09:49:01 CET 2012
commit 96e2a95ee17b19b35ec880b08a23696cc8a16f36
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 27 08:47:12 2012 +0000
Avoid taking the saintmode lock if the list empty.
Submitted by: DocWilco
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 961cb8d..52f1c38 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -261,16 +261,15 @@ vbe_Healthy(const struct vdi_simple *vs, const struct sess *sp)
/* VRT/VCC sets threshold to UINT_MAX to mark that it's not
* specified by VCL (thus use param).
*/
- if (vs->vrt->saintmode_threshold == UINT_MAX)
+ threshold = vs->vrt->saintmode_threshold;
+ if (threshold == UINT_MAX)
threshold = cache_param->saintmode_threshold;
- else
- threshold = vs->vrt->saintmode_threshold;
if (backend->admin_health == ah_healthy)
threshold = UINT_MAX;
- /* Saintmode is disabled */
- if (threshold == 0)
+ /* Saintmode is disabled, or list is empty */
+ if (threshold == 0 || VTAILQ_EMPTY(&backend->troublelist))
return (1);
if (sp->req->objcore == NULL)
More information about the varnish-commit
mailing list