[6.0] 9f50fc171 Call VCL_Onboard whenever a req or bo gets a particular VCL for the first time.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:07 UTC 2018


commit 9f50fc171290a7a17648cb948c3a1b1a19b4ebb9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Aug 23 07:47:55 2018 +0000

    Call VCL_Onboard whenever a req or bo gets a particular VCL for the first time.

diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 3533c665e..5527b588c 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -133,6 +133,7 @@ VBO_GetBusyObj(struct worker *wrk, const struct req *req)
 	bo->director_req = req->director_hint;
 	bo->vcl = req->vcl;
 	VCL_Ref(bo->vcl);
+	VCL_Onboard(NULL, bo);
 
 	bo->t_first = bo->t_prev = NAN;
 
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 1829804d6..516268c5b 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -164,6 +164,7 @@ ved_include(struct req *preq, const char *src, const char *host,
 	AZ(req->vcl);
 	req->vcl = preq->vcl;
 	preq->vcl = NULL;
+	VCL_Onboard(req, NULL);
 
 	req->req_step = R_STP_RECV;
 	req->t_req = preq->t_req;
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index e967f1d7f..92f21d53d 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -388,6 +388,7 @@ void VCL_Poll(void);
 void VCL_Ref(struct vcl *);
 void VCL_Refresh(struct vcl **);
 void VCL_Rel(struct vcl **);
+void VCL_Onboard(struct req *, struct busyobj *);
 const char *VCL_Return_Name(unsigned);
 const char *VCL_Method_Name(unsigned);
 void VCL_Bo2Ctx(struct vrt_ctx *, struct busyobj *);
diff --git a/bin/varnishd/cache/cache_vcl_vrt.c b/bin/varnishd/cache/cache_vcl_vrt.c
index f040f9027..36e34b53a 100644
--- a/bin/varnishd/cache/cache_vcl_vrt.c
+++ b/bin/varnishd/cache/cache_vcl_vrt.c
@@ -73,6 +73,16 @@ VCL_Method_Name(unsigned m)
 
 /*--------------------------------------------------------------------*/
 
+void
+VCL_Onboard(struct req *req, struct busyobj *bo)
+{
+	
+	CHECK_OBJ_ORNULL(req, REQ_MAGIC);
+	CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC);
+	assert(req != NULL || bo != NULL);
+	assert(req == NULL || bo == NULL);
+}
+
 void
 VCL_Refresh(struct vcl **vcc)
 {
@@ -265,6 +275,7 @@ VRT_vcl_select(VRT_CTX, VCL_VCL vcl)
 	vcl_get(&req->vcl, vcl);
 	/* XXX: better logging */
 	VSLb(ctx->req->vsl, SLT_Debug, "Now using %s VCL", vcl->loaded_name);
+	VCL_Onboard(req, NULL);
 }
 
 struct vclref *
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 650690950..b0dc5f472 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -330,6 +330,7 @@ http1_dissect(struct worker *wrk, struct req *req)
 	VCL_Refresh(&wrk->vcl);
 	req->vcl = wrk->vcl;
 	wrk->vcl = NULL;
+	VCL_Onboard(req, NULL);
 
 	HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod);
 	req->err_code = HTTP1_DissectRequest(req->htc, req->http);
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 41a689732..7713636c4 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -643,6 +643,7 @@ h2_rx_headers(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
 	VCL_Refresh(&wrk->vcl);
 	req->vcl = wrk->vcl;
 	wrk->vcl = NULL;
+	VCL_Onboard(req, NULL);
 	req->acct.req_hdrbytes += h2->rxf_len;
 
 	HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod);


More information about the varnish-commit mailing list