[4.1] 5781f95 Drop the backend mutex while mopping up deleted dynamic backends.

Poul-Henning Kamp phk at FreeBSD.org
Fri Sep 4 15:54:50 CEST 2015


commit 5781f95bf20fbb8bd07c9a3cf1e04b9c61e4815c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jul 8 20:15:18 2015 +0000

    Drop the backend mutex while mopping up deleted dynamic backends.
    
    Spotted by:	Dridi

diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c
index 23d0d44..a9199d3 100644
--- a/bin/varnishd/cache/cache_backend_cfg.c
+++ b/bin/varnishd/cache/cache_backend_cfg.c
@@ -427,8 +427,8 @@ void
 VBE_Poll(void)
 {
 	struct backend *be;
-	Lck_Lock(&backends_mtx);
 	while (1) {
+		Lck_Lock(&backends_mtx);
 		be = VTAILQ_FIRST(&backends);
 		if (be == NULL)
 			break;
@@ -436,6 +436,7 @@ VBE_Poll(void)
 			break;
 		if (be->n_conn > 0)
 			break;
+		Lck_Unlock(&backends_mtx);
 		VCL_DelBackend(be);
 		VBE_Delete(be);
 	}



More information about the varnish-commit mailing list