[4.0] 4332353 Remember to lock the backend's mutex when increasing the refcount during VCL load.
Martin Blix Grydeland
martin at varnish-software.com
Wed Dec 9 16:57:51 CET 2015
commit 43323536ab2f44b20dfa23f774144e374bc8eb0f
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Wed Dec 9 16:53:19 2015 +0100
Remember to lock the backend's mutex when increasing the refcount
during VCL load.
diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c
index b7f6a8d..a5d913f 100644
--- a/bin/varnishd/cache/cache_backend_cfg.c
+++ b/bin/varnishd/cache/cache_backend_cfg.c
@@ -136,7 +136,9 @@ VBE_DropRefVcl(struct backend *b)
CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
+ ASSERT_CLI();
Lck_Lock(&b->mtx);
+ assert(b->vsc->vcls > 0);
b->vsc->vcls--;
VBE_DropRefLocked(b, NULL);
}
@@ -196,7 +198,9 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
if (vb->ipv6_suckaddr != NULL &&
VSA_Compare(b->ipv6, vb->ipv6_suckaddr))
continue;
+ Lck_Lock(&b->mtx);
b->refcount++;
+ Lck_Unlock(&b->mtx);
b->vsc->vcls++;
return (b);
}
More information about the varnish-commit
mailing list