[master] f402e5ff3 Correct the probe heap comparison function

Martin Blix Grydeland martin at varnish-software.com
Mon Nov 11 10:01:06 UTC 2019


commit f402e5ff3063026f6ac779295b318da491a934a9
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 97538cade..3339b722c 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -721,8 +721,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