[4.1] 73b33d6 Lock when a backend is moved between lists

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Mon Sep 12 15:48:16 CEST 2016


commit 73b33d62de5bb843eb1018b2e791a052ffb84966
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Jul 27 17:08:24 2016 +0200

    Lock when a backend is moved between lists
    
    Refs #2008

diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c
index ad96330..50e9e4d 100644
--- a/bin/varnishd/cache/cache_backend_cfg.c
+++ b/bin/varnishd/cache/cache_backend_cfg.c
@@ -157,9 +157,11 @@ VRT_delete_backend(VRT_CTX, struct director **dp)
 	be->admin_health = vbe_ah_deleted;
 	be->health_changed = VTIM_real();
 	be->cooled = VTIM_real() + 60.;
+	Lck_Unlock(&be->mtx);
+	Lck_Lock(&backends_mtx);
 	VTAILQ_REMOVE(&backends, be, list);
 	VTAILQ_INSERT_TAIL(&cool_backends, be, list);
-	Lck_Unlock(&be->mtx);
+	Lck_Unlock(&backends_mtx);
 
 	// NB. The backend is still usable for the ongoing transactions,
 	// this is why we don't bust the director's magic number.



More information about the varnish-commit mailing list