[master] 08593cb92 Add an assert that VRT_delete_backend is only called once

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Dec 24 14:57:06 UTC 2019


commit 08593cb921d11f82dd8cf0b25c2fb5cab82d0d4b
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Dec 4 13:10:07 2019 +0100

    Add an assert that VRT_delete_backend is only called once
    
    VRT_delete_backend() sets be->cooled to non-zero as the only place where
    that is done. Assert that it is zero on entry as a check that
    VRT_delete_backend isn't called multiple times.

diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 197065932..4bc367c22 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -655,6 +655,7 @@ VRT_delete_backend(VRT_CTX, VCL_BACKEND *dp)
 	VRT_DisableDirector(be->director);
 	Lck_Unlock(&be->mtx);
 	Lck_Lock(&backends_mtx);
+	AZ(be->cooled);
 	be->cooled = VTIM_real() + 60.;
 	VTAILQ_REMOVE(&backends, be, list);
 	VTAILQ_INSERT_TAIL(&cool_backends, be, list);


More information about the varnish-commit mailing list