[6.0] 2d666b033 make VFP_Close() idempotent

Reza Naghibi reza at naghibi.com
Tue Jun 16 15:59:08 UTC 2020


commit 2d666b03337356a680a4235fd2ce6224af5613ec
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Oct 2 16:42:46 2019 +0200

    make VFP_Close() idempotent
    
    required for #3009

diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index 1413f1bbd..9bc59bf2f 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -118,13 +118,14 @@ VFP_Setup(struct vfp_ctx *vc, struct worker *wrk)
 void
 VFP_Close(struct vfp_ctx *vc)
 {
-	struct vfp_entry *vfe;
+	struct vfp_entry *vfe, *tmp;
 
-	VTAILQ_FOREACH(vfe, &vc->vfp, list) {
+	VTAILQ_FOREACH_SAFE(vfe, &vc->vfp, list, tmp) {
 		if (vfe->vfp->fini != NULL)
 			vfe->vfp->fini(vc, vfe);
 		VSLb(vc->wrk->vsl, SLT_VfpAcct, "%s %ju %ju", vfe->vfp->name,
 		    (uintmax_t)vfe->calls, (uintmax_t)vfe->bytes_out);
+		VTAILQ_REMOVE(&vc->vfp, vfe, list);
 	}
 }
 


More information about the varnish-commit mailing list