[master] 787795e Add VSL_End() function to make closedown of cached VSLs consistent
Poul-Henning Kamp
phk at FreeBSD.org
Tue Jul 22 15:57:33 CEST 2014
commit 787795e5fe795a39ac576ce91b34fc8f9bd11361
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Jul 22 13:57:12 2014 +0000
Add VSL_End() function to make closedown of cached VSLs consistent
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 45f2713..833e8a0 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1097,6 +1097,7 @@ void VSM_Init(void);
void *VSM_Alloc(unsigned size, const char *class, const char *type,
const char *ident);
void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len);
+void VSL_End(struct vsl_log *vsl);
void VSM_Free(void *ptr);
#ifdef VSL_ENDMARKER
void VSL(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, ...)
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index d0ec1d2..a3fc0b9 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -195,8 +195,7 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
(uintmax_t)bo->acct.beresp_bodybytes,
(uintmax_t)(bo->acct.beresp_hdrbytes + bo->acct.beresp_bodybytes));
- VSLb(bo->vsl, SLT_End, "%s", "");
- VSL_Flush(bo->vsl, 0);
+ VSL_End(bo->vsl);
if (bo->fetch_objcore != NULL) {
AN(wrk);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 0d72714..df87210 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -126,11 +126,7 @@ ved_include(struct req *preq, const char *src, const char *host)
}
AN(WRW_IsReleased(wrk));
- /* Flush and release the log */
- AN(req->vsl->wid);
- VSLb(req->vsl, SLT_End, "%s", "");
- VSL_Flush(req->vsl, 0);
- req->vsl->wid = 0;
+ VSL_End(req->vsl);
/* Charge the transmitted body byte counts to the parent request */
preq->acct.resp_bodybytes += req->acct.resp_bodybytes;
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 1db32b4..859a53c 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -236,9 +236,8 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo)
// XXX: BereqEnd + BereqAcct ?
wid = VXID_Get(&wrk->vxid_pool);
VSLb(bo->vsl, SLT_Link, "bereq %u retry", wid);
- VSLb(bo->vsl, SLT_End, "%s", "");
- VSL_Flush(bo->vsl, 0);
owid = VXID(bo->vsl->wid);
+ VSL_End(bo->vsl);
bo->vsl->wid = wid | VSL_BACKENDMARKER;
VSLb(bo->vsl, SLT_Begin, "bereq %u retry", owid);
VSLb_ts_busyobj(bo, "Start", bo->t_prev);
diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c
index 6fd2a8d..031be54 100644
--- a/bin/varnishd/cache/cache_http1_fsm.c
+++ b/bin/varnishd/cache/cache_http1_fsm.c
@@ -210,11 +210,7 @@ http1_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
req->resp_hdrbytes = 0;
req->resp_bodybytes = 0;
- /* Nuke the VXID. http1_dissect() will allocate a new one when
- necessary */
- VSLb(req->vsl, SLT_End, "%s", "");
- VSL_Flush(req->vsl, 0);
- req->vsl->wid = 0;
+ VSL_End(req->vsl);
if (!isnan(req->t_prev) && req->t_prev > 0.)
sp->t_idle = req->t_prev;
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index c00559b..146661f 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -649,9 +649,8 @@ cnt_restart(struct worker *wrk, struct req *req)
// XXX: ReqEnd + ReqAcct ?
VSLb_ts_req(req, "Restart", W_TIM_real(wrk));
VSLb(req->vsl, SLT_Link, "req %u restart", wid);
- VSLb(req->vsl, SLT_End, "%s", "");
- VSL_Flush(req->vsl, 0);
owid = req->vsl->wid & VSL_IDENTMASK;
+ VSL_End(req->vsl);
req->vsl->wid = wid | VSL_CLIENTMARKER;
VSLb(req->vsl, SLT_Begin, "req %u restart", owid);
VSLb_ts_req(req, "Start", req->t_prev);
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 786a26e..a58aa24 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -398,6 +398,7 @@ SES_ReleaseReq(struct req *req)
#undef ACCT
AZ(req->vcl);
+ AZ(req->vsl->wid);
sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
pp = sp->sesspool;
@@ -405,9 +406,6 @@ SES_ReleaseReq(struct req *req)
AN(pp->pool);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
MPL_AssertSane(req);
- if (req->vsl->wid != 0)
- /* Non-released VXID - assume it was from a req */
- VSLb(req->vsl, SLT_End, "%s", "");
VSL_Flush(req->vsl, 0);
req->sp = NULL;
MPL_Free(pp->mpl_req, req);
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index d0733d7..eb70686 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -388,6 +388,22 @@ VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len)
/*--------------------------------------------------------------------*/
+void
+VSL_End(struct vsl_log *vsl)
+{
+ txt t;
+ char p[] = "";
+
+ AN(vsl->wid);
+ t.b = p;
+ t.e = p;
+ VSLbt(vsl, SLT_End, t);
+ VSL_Flush(vsl, 0);
+ vsl->wid = 0;
+}
+
+/*--------------------------------------------------------------------*/
+
static void *
vsm_cleaner(void *priv)
{
More information about the varnish-commit
mailing list