[6.0] 8bf63a886 Correct the probe heap comparison function

Reza Naghibi reza at naghibi.com
Thu Dec 19 21:04:07 UTC 2019


commit 8bf63a886f6b2c74dcb6a246fc8fdd425c5a3408
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Nov 5 16:25:28 2019 +0100

    Correct the probe heap comparison function
    
    Fix the probe scheduler heap comparison function to be consistent with
    regard to different running state of the two arguments. With this fix,
    probes that are not running will always bubble to the top before those
    that are already running.

diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index 9ed6e515c..b488c1525 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -696,8 +696,8 @@ vbp_cmp(void *priv, const void *a, const void *b)
 	CAST_OBJ_NOTNULL(aa, a, VBP_TARGET_MAGIC);
 	CAST_OBJ_NOTNULL(bb, b, VBP_TARGET_MAGIC);
 
-	if (aa->running && !bb->running)
-		return (0);
+	if ((aa->running == 0) != (bb->running == 0))
+		return (aa->running == 0);
 
 	return (aa->due < bb->due);
 }


More information about the varnish-commit mailing list