[master] d378007 Properly give esi_level>0 requests their own VDP stack which passes down to parents VDP stack.
Poul-Henning Kamp
phk at FreeBSD.org
Thu Oct 23 14:46:50 CEST 2014
commit d37800783d93d7314d0f370cee51a94bb96d40f6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Oct 23 12:46:09 2014 +0000
Properly give esi_level>0 requests their own VDP stack which
passes down to parents VDP stack.
Always close all the VDPs.
diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index dc0b4f7..5b6e94d 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -83,3 +83,12 @@ VDP_pop(struct req *req, vdp_bytes *func)
AZ(vdp->priv);
req->vdp_nxt = VTAILQ_FIRST(&req->vdp);
}
+
+void
+VDP_close(struct req *req)
+{
+
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ while (!VTAILQ_EMPTY(&req->vdp))
+ VDP_pop(req, VTAILQ_FIRST(&req->vdp)->func);
+}
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 5f13e9b..9c28ac3 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -43,6 +43,27 @@
/*--------------------------------------------------------------------*/
+static int __match_proto__(vdp_bytes)
+ved_vdp_bytes(struct req *req, enum vdp_action act, void **priv,
+ const void *ptr, ssize_t len)
+{
+ struct req *preq;
+
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ if (act == VDP_INIT)
+ return (0);
+ if (act == VDP_FINI) {
+ *priv = NULL;
+ return (0);
+ }
+ CAST_OBJ_NOTNULL(preq, *priv, REQ_MAGIC);
+ req->acct.resp_bodybytes += len;
+ return (VDP_bytes(preq, act, ptr, len));
+}
+
+
+/*--------------------------------------------------------------------*/
+
static void
ved_include(struct req *preq, const char *src, const char *host)
{
@@ -112,13 +133,16 @@ ved_include(struct req *preq, const char *src, const char *host)
req->l_crc = preq->l_crc;
- req->vdp = preq->vdp;
- req->vdp_nxt = preq->vdp_nxt;
+ req->vdp_nxt = 0;
+ VTAILQ_INIT(&req->vdp);
+ VDP_push(req, ved_vdp_bytes, preq);
THR_SetRequest(req);
VSLb_ts_req(req, "Start", W_TIM_real(wrk));
+ req->ws_req = WS_Snapshot(req->ws);
+
while (1) {
req->wrk = wrk;
s = CNT_Request(wrk, req);
@@ -132,8 +156,7 @@ ved_include(struct req *preq, const char *src, const char *host)
}
AN(V1L_IsReleased(wrk));
- /* Charge the transmitted body byte counts also to the parent request */
- preq->acct.resp_bodybytes += req->acct.resp_bodybytes;
+ VDP_close(req);
CNT_AcctLogCharge(wrk->stats, req);
VSL_End(req->vsl);
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index 80dc7d2..2912ece 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -89,10 +89,10 @@ enum vfp_status VFP_GetStorage(struct vfp_ctx *, ssize_t *sz, uint8_t **ptr);
enum vdp_action {
VDP_INIT,
+ VDP_FINI,
VDP_NULL,
VDP_FLUSH,
VDP_FINISH,
- VDP_FINI,
};
typedef int vdp_bytes(struct req *, enum vdp_action, void **priv,
@@ -109,6 +109,7 @@ struct vdp_entry {
int VDP_bytes(struct req *, enum vdp_action act, const void *ptr, ssize_t len);
void VDP_push(struct req *, vdp_bytes *func, void *priv);
void VDP_pop(struct req *, vdp_bytes *func);
+void VDP_close(struct req *req);
vdp_bytes VDP_gunzip;
vdp_bytes VED_pretend_gzip;
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 2198085..d9eae86 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -384,4 +384,6 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
if ((V1L_FlushRelease(req->wrk) || ois != OIS_DONE) &&
req->sp->fd >= 0)
SES_Close(req->sp, SC_REM_CLOSE);
+ if (req->esi_level == 0)
+ VDP_close(req);
}
diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c
index 4e2f027..a2781d1 100644
--- a/bin/varnishd/http1/cache_http1_line.c
+++ b/bin/varnishd/http1/cache_http1_line.c
@@ -93,7 +93,7 @@ V1L_Reserve(struct worker *wrk, int *fd, struct vsl_log *vsl, double t0)
wrk->v1l = v1l;
}
-unsigned
+unsigned
V1L_FlushRelease(struct worker *wrk)
{
struct v1l *v1l;
More information about the varnish-commit
mailing list