[master] 6ef48bab3 Purge VCL list from behind to tear down dependencies in order.
Poul-Henning Kamp
phk at FreeBSD.org
Mon May 27 20:47:07 UTC 2019
commit 6ef48bab3dd9be7e9836641e754bba36b1759508
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon May 27 20:46:20 2019 +0000
Purge VCL list from behind to tear down dependencies in order.
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 4347a3abd..1e9c6939d 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -222,8 +222,10 @@ mgt_vcl_del(struct vclprog *vp)
struct vmodfile *vf;
CHECK_OBJ_NOTNULL(vp, VCLPROG_MAGIC);
- while (!VTAILQ_EMPTY(&vp->dto))
- mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dto));
+ assert(VTAILQ_EMPTY(&vp->dto));
+
+ mgt_vcl_symtab_clean(vp);
+
while (!VTAILQ_EMPTY(&vp->dfrom))
mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dfrom));
@@ -247,7 +249,6 @@ mgt_vcl_del(struct vclprog *vp)
VJ_master(JAIL_MASTER_LOW);
free(vp->fname);
}
- mgt_vcl_symtab_clean(vp);
while (!VTAILQ_EMPTY(&vp->vmods)) {
vd = VTAILQ_FIRST(&vp->vmods);
CHECK_OBJ(vd, VMODDEP_MAGIC);
@@ -915,16 +916,15 @@ static struct cli_proto cli_vcl[] = {
static void
mgt_vcl_atexit(void)
{
- struct vclprog *vp;
+ struct vclprog *vp, *vp2;
if (getpid() != heritage.mgt_pid)
return;
active_vcl = NULL;
- do {
- vp = VTAILQ_FIRST(&vclhead);
- if (vp != NULL)
- mgt_vcl_del(vp);
- } while (vp != NULL);
+ VTAILQ_FOREACH_REVERSE_SAFE(vp, &vclhead, vclproghead, list, vp2) {
+ assert(VTAILQ_EMPTY(&vp->dto));
+ mgt_vcl_del(vp);
+ }
}
void
More information about the varnish-commit
mailing list