[master] 413a772 Remove the direct pointer from boc to busyobj

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


commit 413a7720a6ef80dde4f038d861d24329e325a6e2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jan 21 21:46:29 2016 +0000

    Remove the direct pointer from boc to busyobj
    
    Dump boc's in panic output

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7cc4c5c..4d58308 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -398,8 +398,6 @@ struct boc {
 	void			*stevedore_priv;
 	enum boc_state_e	state;
 	uint8_t			*vary;
-
-	struct busyobj		*busyobj;
 };
 
 /* Object core structure ---------------------------------------------
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 75a4d38..05b5482 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -957,6 +957,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 
 	wrk->vsl = NULL;
 	HSH_DerefBusy(wrk, bo->fetch_objcore);
+	VBO_DerefBusyObj(wrk, &bo);
 	THR_SetBusyobj(NULL);
 }
 
@@ -987,7 +988,6 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 
 	bo = VBO_GetBusyObj(wrk, req);
 	bo->boc = oc->boc;
-	bo->boc->busyobj = bo;
 
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how);
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 5057f59..7d22c25 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -760,7 +760,6 @@ HSH_DerefBusy(struct worker *wrk, struct objcore *oc)
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 	boc = oc->boc;
 	CHECK_OBJ_NOTNULL(boc, BOC_MAGIC);
-	CHECK_OBJ_NOTNULL(boc->busyobj, BUSYOBJ_MAGIC);
 	Lck_Lock(&oc->objhead->mtx);
 	assert(boc->refcount > 0);
 	r = --boc->refcount;
@@ -770,7 +769,6 @@ HSH_DerefBusy(struct worker *wrk, struct objcore *oc)
 	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);
 		free(boc->vary);
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 7d8f47b..54789ac 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -188,6 +188,20 @@ pan_http(struct vsb *vsb, const char *id, const struct http *h)
 }
 
 /*--------------------------------------------------------------------*/
+static void
+pan_boc(struct vsb *vsb, const struct boc *boc)
+{
+	VSB_printf(vsb, "boc = %p {\n", boc);
+	VSB_indent(vsb, 2);
+	VSB_printf(vsb, "refcnt = %u,\n", boc->refcount);
+	VSB_printf(vsb, "state = %d,\n", boc->state);
+	VSB_printf(vsb, "vary = %p,\n", boc->vary);
+	VSB_printf(vsb, "stevedore_priv = %p,\n", boc->stevedore_priv);
+	VSB_indent(vsb, -2);
+	VSB_printf(vsb, "},\n");
+}
+
+/*--------------------------------------------------------------------*/
 
 static void
 pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc)
@@ -198,6 +212,8 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc)
 	VSB_printf(vsb, "refcnt = %d,\n", oc->refcnt);
 	VSB_printf(vsb, "flags = 0x%x,\n", oc->flags);
 	VSB_printf(vsb, "exp_flags = 0x%x,\n", oc->exp_flags);
+	if (oc->boc != NULL)
+		pan_boc(vsb, oc->boc);
 	VSB_printf(vsb, "exp = { %f, %f, %f, %f }\n",
 	    oc->exp.t_origin, oc->exp.ttl, oc->exp.grace, oc->exp.keep);
 	VSB_printf(vsb, "objhead = %p,\n", oc->objhead);
@@ -315,12 +331,6 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
 	VSB_printf(vsb, "},\n");
 }
 
-static void
-pan_boc(struct vsb *vsb, const struct boc *boc)
-{
-	pan_busyobj(vsb, boc->busyobj);
-}
-
 /*--------------------------------------------------------------------*/
 
 static void
@@ -370,11 +380,8 @@ pan_req(struct vsb *vsb, const struct req *req)
 
 	VCL_Panic(vsb, req->vcl);
 
-	if (req->objcore != NULL) {
+	if (req->objcore != NULL)
 		pan_objcore(vsb, "REQ", req->objcore);
-		if (req->objcore->boc != NULL)
-			pan_boc(vsb, req->objcore->boc);
-	}
 
 	VSB_printf(vsb, "flags = {\n");
 	VSB_indent(vsb, 2);



More information about the varnish-commit mailing list