[master] ef7ad9c Clean up boc->refcount initialization
Poul-Henning Kamp
phk at FreeBSD.org
Thu Jan 28 12:49:19 CET 2016
commit ef7ad9c043a9e9d4abbf8a183867c5549f1d9604
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jan 20 23:18:41 2016 +0000
Clean up boc->refcount initialization
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 4c199a3..45a6968 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -72,6 +72,7 @@ vbo_New(void)
Lck_New(&bo->boc->mtx, lck_busyobj);
AZ(pthread_cond_init(&bo->boc->cond, NULL));
bo->boc->busyobj = bo;
+ bo->boc->refcount = 1;
return (bo);
}
@@ -103,9 +104,6 @@ VBO_GetBusyObj(struct worker *wrk, const struct req *req)
bo = vbo_New();
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
- AZ(bo->boc->refcount);
-
- bo->boc->refcount = 1;
p = (void*)(bo + 1);
p = (void*)PRNDUP(p);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 9e12f18..3087972 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -985,16 +985,17 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
}
bo = VBO_GetBusyObj(wrk, req);
+ oc->boc = bo->boc;
+
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how);
VSLb(req->vsl, SLT_Link, "bereq %u %s", VXID(bo->vsl->wid), how);
THR_SetBusyobj(bo);
+ assert(HSH_RefBusy(oc) == bo->boc);
bo_fetch = bo;
- bo->boc->refcount = 2;
- oc->boc = bo->boc;
AN(bo->vcl);
More information about the varnish-commit
mailing list