[master] eb0b073 -spersistent: only process events for our own objects

Nils Goroll nils.goroll at uplex.de
Mon Jul 11 14:31:07 CEST 2016


commit eb0b073f77010fd6d85c97d82aa53ed7a5f72b95
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Jul 11 14:27:50 2016 +0200

    -spersistent: only process events for our own objects
    
    Adresses a new issue mentioned in #2004

diff --git a/bin/varnishd/storage/storage_persistent.c b/bin/varnishd/storage/storage_persistent.c
index 7991d9b..6cc8542 100644
--- a/bin/varnishd/storage/storage_persistent.c
+++ b/bin/varnishd/storage/storage_persistent.c
@@ -372,6 +372,9 @@ smp_open(struct stevedore *st)
 
 	/* XXX: abandon early segments to make sure we have free space ? */
 
+	(void)ObjSubscribeEvents(smp_oc_event, st,
+	    OEV_BANCHG|OEV_TTLCHG|OEV_INSERT);
+
 	/* Open a new segment, so we are ready to write */
 	smp_new_seg(sc);
 
@@ -683,8 +686,6 @@ smp_init(void)
 	smp_oc_realmethods = SML_methods;
 	smp_oc_realmethods.objtouch = NULL;
 	smp_oc_realmethods.objfree = smp_oc_objfree;
-	(void)ObjSubscribeEvents(smp_oc_event, NULL,
-	    OEV_BANCHG|OEV_TTLCHG|OEV_INSERT);
 }
 
 /*--------------------------------------------------------------------
diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c
index 4c7268b..b1dd439 100644
--- a/bin/varnishd/storage/storage_persistent_silo.c
+++ b/bin/varnishd/storage/storage_persistent_silo.c
@@ -501,13 +501,17 @@ smp_init_oc(struct objcore *oc, struct smp_seg *sg, unsigned objidx)
 void __match_proto__(obj_event_f)
 smp_oc_event(struct worker *wrk, void *priv, struct objcore *oc, unsigned ev)
 {
+	struct stevedore *st;
 	struct smp_seg *sg;
 	struct smp_object *so;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	AZ(priv);
+	CAST_OBJ_NOTNULL(st, priv, STEVEDORE_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 
+	if (oc->stobj->stevedore != st)
+		return;
+
 	CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC);
 	CHECK_OBJ_NOTNULL(sg->sc, SMP_SC_MAGIC);
 	so = smp_find_so(sg, oc->stobj->priv2);



More information about the varnish-commit mailing list