[master] c8e7c20 Call ObjStable() when the boc goes away.

Poul-Henning Kamp phk at FreeBSD.org
Thu Jan 28 12:49:20 CET 2016


commit c8e7c20e136073c7acedc2a61b8a13f1388ec74a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jan 21 20:24:34 2016 +0000

    Call ObjStable() when the boc goes away.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 564023e..442fe48 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -870,7 +870,7 @@ void *ObjSetattr(struct worker *, struct objcore *, enum obj_attr attr,
     ssize_t len, const void *);
 int ObjCopyAttr(struct worker *, struct objcore *, struct objcore *,
     enum obj_attr attr);
-void ObjStable(struct worker *, struct objcore *, struct busyobj *);
+void ObjStable(struct worker *, struct objcore *, struct boc *);
 
 int ObjSetDouble(struct worker *, struct objcore *, enum obj_attr, double);
 int ObjSetU32(struct worker *, struct objcore *, enum obj_attr, uint32_t);
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 110c44f..fbe6046 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -177,8 +177,6 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
 
 	if (bo->fetch_objcore != NULL) {
 		AN(wrk);
-		if (bo->fetch_objcore->stobj->stevedore != NULL)
-			ObjStable(bo->wrk, bo->fetch_objcore, bo);
 		(void)HSH_DerefObjCore(wrk, &bo->fetch_objcore);
 	}
 
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 039c694..5057f59 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -768,6 +768,8 @@ HSH_DerefBusy(struct worker *wrk, struct objcore *oc)
 		oc->boc = NULL;
 	Lck_Unlock(&oc->objhead->mtx);
 	if (r == 0) {
+		if (oc->stobj->stevedore != NULL)
+			ObjStable(wrk, oc, boc);
 		VBO_DerefBusyObj(wrk, &boc->busyobj);
 		AZ(pthread_cond_destroy(&boc->cond));
 		Lck_Delete(&boc->mtx);
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 9bb6071..018e280 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -256,19 +256,19 @@ ObjUpdateMeta(struct worker *wrk, struct objcore *oc)
 }
 
 /*====================================================================
- * Called when the busyobj used to populate the objcore is going away.
+ * Called when the boc used to populate the objcore is going away.
  * Useful for releasing any leftovers from Trim.
  */
 
 void
-ObjStable(struct worker *wrk, struct objcore *oc, struct busyobj *bo)
+ObjStable(struct worker *wrk, struct objcore *oc, struct boc *boc)
 {
 	const struct obj_methods *m = obj_getmethods(oc);
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(boc, BOC_MAGIC);
 	if (m->objstable != NULL)
-		m->objstable(wrk, oc, bo);
+		m->objstable(wrk, oc, boc);
 }
 
 /*====================================================================
diff --git a/bin/varnishd/cache/cache_obj.h b/bin/varnishd/cache/cache_obj.h
index 0058434..3fba1ef 100644
--- a/bin/varnishd/cache/cache_obj.h
+++ b/bin/varnishd/cache/cache_obj.h
@@ -43,7 +43,7 @@ typedef int objgetspace_f(struct worker *, struct objcore *,
      ssize_t *sz, uint8_t **ptr);
 typedef void objextend_f(struct worker *, struct objcore *, ssize_t l);
 typedef void objtrimstore_f(struct worker *, struct objcore *);
-typedef void objstable_f(struct worker *, struct objcore *, struct busyobj *);
+typedef void objstable_f(struct worker *, struct objcore *, struct boc *);
 typedef void objslim_f(struct worker *, struct objcore *);
 typedef void *objgetattr_f(struct worker *, struct objcore *,
     enum obj_attr attr, ssize_t *len);
diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index 8d313fb..79440d2 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -484,19 +484,19 @@ sml_trimstore(struct worker *wrk, struct objcore *oc)
 }
 
 static void __match_proto__(objstable_f)
-sml_stable(struct worker *wrk, struct objcore *oc, struct busyobj *bo)
+sml_stable(struct worker *wrk, struct objcore *oc, struct boc *boc)
 {
 	const struct stevedore *stv;
 	struct storage *st;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(boc, BOC_MAGIC);
 
-	if (bo->boc->stevedore_priv == NULL)
+	if (boc->stevedore_priv == NULL)
 		return;
-	CAST_OBJ_NOTNULL(st, bo->boc->stevedore_priv, STORAGE_MAGIC);
-	bo->boc->stevedore_priv = 0;
+	CAST_OBJ_NOTNULL(st, boc->stevedore_priv, STORAGE_MAGIC);
+	boc->stevedore_priv = 0;
 	CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
 	stv = oc->stobj->stevedore;
 	CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);



More information about the varnish-commit mailing list