r4437 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Jan 8 11:17:32 CET 2010


Author: phk
Date: 2010-01-08 11:17:32 +0100 (Fri, 08 Jan 2010)
New Revision: 4437

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend.c
Log:
Break down and lock the n_vbe_conn counter to avoid over & underflows.

Fixes #604



Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-01-08 09:36:17 UTC (rev 4436)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-01-08 10:17:32 UTC (rev 4437)
@@ -84,7 +84,9 @@
 		VSL_stats->backend_unused++;
 		Lck_Unlock(&VBE_mtx);
 	} else {
+		Lck_Lock(&VBE_mtx);
 		VSL_stats->n_vbe_conn--;
+		Lck_Unlock(&VBE_mtx);
 		free(vc);
 	}
 }
@@ -211,7 +213,9 @@
 	XXXAN(vc);
 	vc->magic = VBE_CONN_MAGIC;
 	vc->fd = -1;
+	Lck_Lock(&VBE_mtx);
 	VSL_stats->n_vbe_conn++;
+	Lck_Unlock(&VBE_mtx);
 	return (vc);
 }
 



More information about the varnish-commit mailing list