[master] a26fdcd Hold a ref on the oc for BACKGROUND fetches until we have checked that we can continue.

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 2 09:44:21 CET 2016


commit a26fdcd6071a6938759039f2513ca624a21b0e72
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 2 08:43:42 2016 +0000

    Hold a ref on the oc for BACKGROUND fetches until we have checked
    that we can continue.
    
    Fixes #1849

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 83d72be..5332e7c 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -1006,8 +1006,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 	oc->boc->vary = req->vary_b;
 	req->vary_b = NULL;
 
-	if (mode != VBF_BACKGROUND)
-		HSH_Ref(oc);
+	HSH_Ref(oc);
 	AZ(bo->fetch_objcore);
 	bo->fetch_objcore = oc;
 
@@ -1047,5 +1046,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 	VSLb_ts_req(req, "Fetch", W_TIM_real(wrk));
 	assert(oc->boc == boc);
 	HSH_DerefBusy(wrk, oc);
+	if (mode == VBF_BACKGROUND)
+		(void)HSH_DerefObjCore(wrk, &oc);
 	THR_SetBusyobj(NULL);
 }



More information about the varnish-commit mailing list