[6.0] 3164e8d64 avoid holding the ban_mtx unless we need to

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:23 UTC 2018


commit 3164e8d64b0ccb2ce515b5d276865318c2e6fdb6
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Sep 26 08:21:37 2018 +0200

    avoid holding the ban_mtx unless we need to

diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c
index defe55d91..1729e04a9 100644
--- a/bin/varnishd/cache/cache_ban_lurker.c
+++ b/bin/varnishd/cache/cache_ban_lurker.c
@@ -229,6 +229,11 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
 		}
 		oc = ban_lurker_getfirst(vsl, bt);
 		if (oc == NULL) {
+			if (tested == 0 && lokc == 0) {
+				AZ(tested_tests);
+				AZ(lok);
+				return;
+			}
 			Lck_Lock(&ban_mtx);
 			VSC_C_main->bans_lurker_tested += tested;
 			VSC_C_main->bans_lurker_tests_tested += tested_tests;


More information about the varnish-commit mailing list