[PATCH 12/13] Also report dropped bans to the stevedores.
Martin Blix Grydeland
martin at varnish-software.com
Mon Oct 1 12:26:19 CEST 2012
---
bin/varnishd/cache/cache.h | 1 +
bin/varnishd/cache/cache_ban.c | 6 ++++++
bin/varnishd/storage/stevedore.c | 10 ++++++++++
bin/varnishd/storage/storage.h | 3 +++
4 files changed, 20 insertions(+)
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7ecf954..95fc5e2 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1055,6 +1055,7 @@ void STV_open(void);
void STV_close(void);
void STV_Freestore(struct object *o);
void STV_NewBan(const uint8_t *ban, unsigned len);
+void STV_DropBan(const uint8_t *ban, unsigned len);
/* storage_synth.c */
struct vsb *SMS_Makesynth(struct object *obj);
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index f895467..4f0d332 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -814,6 +814,9 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl, unsigned pass)
do {
Lck_Lock(&ban_mtx);
b2 = ban_CheckLast();
+ if (b2 != NULL)
+ /* Notify stevedores */
+ STV_DropBan(b2->spec, ban_len(b2->spec));
Lck_Unlock(&ban_mtx);
if (b2 != NULL)
BAN_Free(b2);
@@ -961,6 +964,9 @@ ban_lurker(struct worker *wrk, void *priv)
*/
Lck_Lock(&ban_mtx);
bf = ban_CheckLast();
+ if (bf != NULL)
+ /* Notify stevedores */
+ STV_DropBan(bf->spec, ban_len(bf->spec));
Lck_Unlock(&ban_mtx);
if (bf != NULL)
BAN_Free(bf);
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index c02e5f7..b79f197 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -463,6 +463,16 @@ STV_NewBan(const uint8_t *ban, unsigned len)
stv->newban(stv, ban, len);
}
+void
+STV_DropBan(const uint8_t *ban, unsigned len)
+{
+ struct stevedore *stv;
+
+ VTAILQ_FOREACH(stv, &stv_stevedores, list)
+ if (stv->dropban != NULL)
+ stv->dropban(stv, ban, len);
+}
+
/*--------------------------------------------------------------------
* VRT functions for stevedores
*/
diff --git a/bin/varnishd/storage/storage.h b/bin/varnishd/storage/storage.h
index 49cd0f8..740f282 100644
--- a/bin/varnishd/storage/storage.h
+++ b/bin/varnishd/storage/storage.h
@@ -50,6 +50,8 @@ typedef void storage_close_f(const struct stevedore *);
typedef void storage_signal_close_f(const struct stevedore *);
typedef void storage_newban_f(struct stevedore *, const uint8_t *ban,
unsigned len);
+typedef void storage_dropban_f(struct stevedore *, const uint8_t *ban,
+ unsigned len);
/* Prototypes for VCL variable responders */
#define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
@@ -74,6 +76,7 @@ struct stevedore {
storage_allocobj_f *allocobj; /* --//-- */
storage_signal_close_f *signal_close; /* --//-- */
storage_newban_f *newban; /* --//-- */
+ storage_dropban_f *dropban; /* --//-- */
struct lru *lru;
--
1.7.9.5
More information about the varnish-dev
mailing list