[master] 19ff8f1 Fix the VBE/VCL reference count anomaly

Poul-Henning Kamp phk at varnish-cache.org
Thu Mar 31 21:14:16 CEST 2011


commit 19ff8f182b582fbea85cfef40142b5b45865276e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Mar 31 19:13:59 2011 +0000

    Fix the VBE/VCL reference count anomaly

diff --git a/bin/varnishd/cache_backend.c b/bin/varnishd/cache_backend.c
index a1886e1..93f4a77 100644
--- a/bin/varnishd/cache_backend.c
+++ b/bin/varnishd/cache_backend.c
@@ -479,7 +479,7 @@ vdi_simple_fini(const struct director *d)
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
 
 	VBP_Stop(vs->backend, vs->vrt->probe);
-	VBE_DropRef(vs->backend);
+	VBE_DropRefVcl(vs->backend);
 	free(vs->dir.vcl_name);
 	vs->dir.magic = 0;
 	FREE_OBJ(vs);
diff --git a/bin/varnishd/cache_backend.h b/bin/varnishd/cache_backend.h
index e620068..a437256 100644
--- a/bin/varnishd/cache_backend.h
+++ b/bin/varnishd/cache_backend.h
@@ -143,7 +143,7 @@ struct backend *vdi_get_backend_if_simple(const struct director *d);
 /* cache_backend_cfg.c */
 extern struct lock VBE_mtx;
 void VBE_DropRefConn(struct backend *);
-void VBE_DropRef(struct backend *);
+void VBE_DropRefVcl(struct backend *);
 void VBE_DropRefLocked(struct backend *b);
 
 /* cache_backend_poll.c */
diff --git a/bin/varnishd/cache_backend_cfg.c b/bin/varnishd/cache_backend_cfg.c
index 17aed49..15dcc80 100644
--- a/bin/varnishd/cache_backend_cfg.c
+++ b/bin/varnishd/cache_backend_cfg.c
@@ -106,7 +106,6 @@ VBE_DropRefLocked(struct backend *b)
 	assert(b->refcount > 0);
 
 	i = --b->refcount;
-	b->vsc->vcls--;
 	Lck_Unlock(&b->mtx);
 	if (i > 0)
 		return;
@@ -125,12 +124,13 @@ VBE_DropRefLocked(struct backend *b)
 }
 
 void
-VBE_DropRef(struct backend *b)
+VBE_DropRefVcl(struct backend *b)
 {
 
 	CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
 
 	Lck_Lock(&b->mtx);
+	b->vsc->vcls--;
 	VBE_DropRefLocked(b);
 }
 



More information about the varnish-commit mailing list