[master] e8641aa Add some missing housekeeping for pipe

Poul-Henning Kamp phk at FreeBSD.org
Tue Jul 22 16:49:18 CEST 2014


commit e8641aaca3ab966421e2b37c9f91b12211fa7f2d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jul 22 14:49:04 2014 +0000

    Add some missing housekeeping for pipe

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 11b15f5..97718bf 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -852,9 +852,6 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 	CHECK_OBJ_ORNULL(oldobj, OBJECT_MAGIC);
 
-	bo = VBO_GetBusyObj(wrk, req);
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	THR_SetBusyobj(bo);
 
 	switch(mode) {
 	case VBF_PASS:		how = "pass"; break;
@@ -863,9 +860,13 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 	default:		WRONG("Wrong fetch mode");
 	}
 
+	bo = VBO_GetBusyObj(wrk, req);
+	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);
+
 	bo->refcount = 2;
 
 	oc->busyobj = bo;
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 4987bda..8542b31 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -597,11 +597,16 @@ cnt_pipe(struct worker *wrk, struct req *req)
 
 	wrk->stats.s_pipe++;
 	bo = VBO_GetBusyObj(wrk, req);
-	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod);
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	VSLb(bo->vsl, SLT_Begin, "bereq %u pipe", VXID(req->vsl->wid));
+	VSLb(req->vsl, SLT_Link, "bereq %u pipe", VXID(bo->vsl->wid));
+	THR_SetBusyobj(bo);
+
+	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod);
 	http_FilterReq(bo->bereq, req->http, 0);	// XXX: 0 ?
 	http_PrintfHeader(bo->bereq, "X-Varnish: %u", VXID(req->vsl->wid));
 	http_SetHeader(bo->bereq, "Connection: close");
+	
 
 	VCL_pipe_method(req->vcl, wrk, req, bo, req->http->ws);
 
@@ -613,6 +618,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
 	PipeRequest(req, bo);
 	assert(WRW_IsReleased(wrk));
 	http_Teardown(bo->bereq);
+	THR_SetBusyobj(NULL);
 	VBO_DerefBusyObj(wrk, &bo);
 	return (REQ_FSM_DONE);
 }



More information about the varnish-commit mailing list