[master] 465f2f8c3 Ensure all director_list operations happen under the vcl_mtx
Nils Goroll
nils.goroll at uplex.de
Mon Nov 18 15:05:07 UTC 2019
commit 465f2f8c364cb7e5c6ae93bf46f2ba0f7c757d92
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Thu Nov 7 09:14:44 2019 +0100
Ensure all director_list operations happen under the vcl_mtx
Ref #3094
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index fe905fea8..721622738 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -278,6 +278,7 @@ vcl_iterdir(struct cli *cli, const char *pat, const struct vcl *vcl,
int i, found = 0;
struct vcldir *vdir;
+ Lck_AssertHeld(&vcl_mtx);
VTAILQ_FOREACH(vdir, &vcl->director_list, list) {
if (fnmatch(pat, vdir->cli_name, 0))
continue;
@@ -343,8 +344,10 @@ vcl_BackendEvent(const struct vcl *vcl, enum vcl_event_e e)
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
AZ(vcl->busy);
+ Lck_Lock(&vcl_mtx);
VTAILQ_FOREACH(vdir, &vcl->director_list, list)
VDI_Event(vdir->dir, e);
+ Lck_Unlock(&vcl_mtx);
}
static void
@@ -355,6 +358,7 @@ vcl_KillBackends(struct vcl *vcl)
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
AZ(vcl->busy);
assert(VTAILQ_EMPTY(&vcl->ref_list));
+ Lck_Lock(&vcl_mtx);
while (1) {
vdir = VTAILQ_FIRST(&vcl->director_list);
if (vdir == NULL)
@@ -366,6 +370,7 @@ vcl_KillBackends(struct vcl *vcl)
FREE_OBJ(vdir->dir);
FREE_OBJ(vdir);
}
+ Lck_Unlock(&vcl_mtx);
}
/*--------------------------------------------------------------------*/
More information about the varnish-commit
mailing list