[master] e2f1dac Register the busyobj on the thread while we do fetch-thread duty.

Poul-Henning Kamp phk at varnish-cache.org
Fri May 24 16:57:40 CEST 2013


commit e2f1dac1d95a1d2a9db3cf1ebcc47a33b16f61cf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 24 14:57:23 2013 +0000

    Register the busyobj on the thread while we do fetch-thread duty.

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 0aa85fe..f1ee9c2 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -802,6 +802,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
 	bo = vsh->bo;
+	THR_SetBusyobj(bo);
 
 	vbf_make_bereq(wrk, req, bo);
 	xxxassert (wrk->handling == VCL_RET_FETCH);
@@ -865,6 +866,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 		case VCL_RET_ERROR:
 			bo->state = BOS_FAILED;
 			VBO_DerefBusyObj(wrk, &bo);
+			THR_SetBusyobj(NULL);
 			return;
 		case VCL_RET_RESTART:
 			INCOMPL();
@@ -897,6 +899,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 			bo->fetch_objcore = NULL;
 			VDI_CloseFd(&bo->vbc);
 			bo->state = BOS_FAILED;
+			THR_SetBusyobj(NULL);
 			return;
 		} else
 			/* No vary */
@@ -932,6 +935,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 		bo->fetch_objcore = NULL;
 		VDI_CloseFd(&bo->vbc);
 		bo->state = BOS_FAILED;
+		THR_SetBusyobj(NULL);
 		return;
 	}
 	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
@@ -994,10 +998,12 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 	if (bo->state == BOS_FAILED) {
 		/* handle early failures */
 		(void)HSH_Deref(&wrk->stats, NULL, &obj);
+		THR_SetBusyobj(NULL);
 		return;
 	}
 
 	assert(WRW_IsReleased(wrk));
+	THR_SetBusyobj(NULL);
 }
 
 void



More information about the varnish-commit mailing list