[master] 42a844a Code Polish
Poul-Henning Kamp
phk at varnish-cache.org
Fri May 6 13:10:24 CEST 2011
commit 42a844a2761edd01f42e5770a35a8e4197c7b21f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri May 6 09:21:05 2011 +0000
Code Polish
diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 885974a..fc55996 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -656,7 +656,7 @@ void BAN_Reload(double t0, unsigned flags, const char *ban);
struct ban *BAN_TailRef(void);
void BAN_Compile(void);
struct ban *BAN_RefBan(struct objcore *oc, double t0, const struct ban *tail);
-void BAN_Deref(struct ban **ban);
+void BAN_TailDeref(struct ban **ban);
/* cache_center.c [CNT] */
void CNT_Session(struct sess *sp);
diff --git a/bin/varnishd/cache_ban.c b/bin/varnishd/cache_ban.c
index 2ba366c..1065e35 100644
--- a/bin/varnishd/cache_ban.c
+++ b/bin/varnishd/cache_ban.c
@@ -549,11 +549,11 @@ ban_lurker(struct sess *sp, void *priv)
/*--------------------------------------------------------------------
- * Release a reference
+ * Release a tail reference
*/
void
-BAN_Deref(struct ban **bb)
+BAN_TailDeref(struct ban **bb)
{
struct ban *b;
diff --git a/bin/varnishd/storage_persistent.c b/bin/varnishd/storage_persistent.c
index d5ee060..c1d88de 100644
--- a/bin/varnishd/storage_persistent.c
+++ b/bin/varnishd/storage_persistent.c
@@ -303,8 +303,8 @@ smp_thread(struct sess *sp, void *priv)
smp_load_seg(sp, sc, sg);
sc->flags |= SMP_SC_LOADED;
- BAN_Deref(&sc->tailban);
- sc->tailban = NULL;
+ BAN_TailDeref(&sc->tailban);
+ AZ(sc->tailban);
printf("Silo completely loaded\n");
while (1) {
(void)sleep (1);
@@ -352,6 +352,11 @@ smp_open(const struct stevedore *st)
if (smp_open_segs(sc, &sc->seg1))
AZ(smp_open_segs(sc, &sc->seg2));
+ /*
+ * Grap a reference to the tail of the ban list, until the thread
+ * has loaded all objects, so we can be sure that all of our
+ * proto-bans survive until then.
+ */
sc->tailban = BAN_TailRef();
AN(sc->tailban);
More information about the varnish-commit
mailing list