[3.0] 412c4f7 Emit BackendXID and check c_flag/b_flag properly

Tollef Fog Heen tfheen at varnish-cache.org
Tue Aug 6 11:56:16 CEST 2013


commit 412c4f754dd805e06803efa170e5d62afd23dd0d
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Tue Aug 6 11:15:15 2013 +0200

    Emit BackendXID and check c_flag/b_flag properly
    
    07d488cb96c703dd7c0ccf7049448c6291f1f0cf partially broke varnishlog,
    since libvarnishapi did not properly check if both -c and -b were
    given.
    
    In addition, varnishd did not emit a tag at the start of a backend
    transaction.  Emit BackendXID since that seems appropriate.
    
    Fixes #1325

diff --git a/bin/varnishd/cache_dir.c b/bin/varnishd/cache_dir.c
index 2463aa8..dd44bf0 100644
--- a/bin/varnishd/cache_dir.c
+++ b/bin/varnishd/cache_dir.c
@@ -94,12 +94,15 @@ VDI_RecycleFd(struct sess *sp)
 struct vbc *
 VDI_GetFd(const struct director *d, struct sess *sp)
 {
-
+	struct vbc *vbc;
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	if (d == NULL)
 		d = sp->director;
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
-	return (d->getfd(d, sp));
+	vbc = d->getfd(d, sp);
+	if (vbc)
+		WSL(sp->wrk, SLT_BackendXID, vbc->fd, "%d", sp->xid);
+	return (vbc);
 }
 
 /* Check health ------------------------------------------------------
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 8ffff30..8ae2856 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -252,9 +252,9 @@ VSL_NextLog(const struct VSM_data *vd, uint32_t **pp, uint64_t *bits)
 		}
 		if (vbit_test(vsl->vbm_supress, t))
 			continue;
-		if (vsl->b_opt && !vbit_test(vsl->vbm_backend, u))
+		if (vsl->b_opt && !vbit_test(vsl->vbm_backend, u) && !vsl->c_opt)
 			continue;
-		if (vsl->c_opt && !vbit_test(vsl->vbm_client, u))
+		if (vsl->c_opt && !vbit_test(vsl->vbm_client, u) && !vsl->b_opt)
 			continue;
 		if (vsl->regincl != NULL) {
 			i = VRE_exec(vsl->regincl, VSL_DATA(p), VSL_LEN(p),



More information about the varnish-commit mailing list