r4861 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Fri May 28 11:28:15 CEST 2010


Author: phk
Date: 2010-05-28 11:28:15 +0200 (Fri, 28 May 2010)
New Revision: 4861

Modified:
   trunk/varnish-cache/bin/varnishd/hash_critbit.c
Log:
Add a single write memory barrier, to be absolutely 100% sure that
the tree is sane at all points.



Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-05-27 10:48:01 UTC (rev 4860)
+++ trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-05-28 09:28:15 UTC (rev 4861)
@@ -43,6 +43,7 @@
 #include "cache.h"
 #include "hash_slinger.h"
 #include "cli_priv.h"
+#include "vmb.h"
 
 static struct lock hcb_mtx;
 
@@ -242,7 +243,7 @@
 
 	CAST_OBJ_NOTNULL(y2, wrk->nhashpriv, HCB_Y_MAGIC);
 	wrk->nhashpriv = NULL;
-	(void)hcb_crit_bit(oh, hcb_l_node(*p), y2);
+	(void)hcb_crit_bit(oh, oh2, y2);
 	s2 = (oh->digest[y2->ptr] & y2->bitmask) != 0;
 	assert(s2 < 2);
 	y2->leaf[s2] = hcb_r_node(oh);
@@ -263,6 +264,7 @@
 		p = &y->leaf[s];
 	}
 	y2->leaf[s2] = *p;
+	VWMB();
 	*p = hcb_r_y(y2);
 	return(oh);
 }




More information about the varnish-commit mailing list