[master] 18bf07a Report VFPs in panics
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jul 9 10:18:02 CEST 2014
commit 18bf07adc1d271ce97e264a4aa7aad004c3d54c0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jul 9 08:16:38 2014 +0000
Report VFPs in panics
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index a83ae19..bdc9554 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -450,6 +450,7 @@ struct vfp_entry {
const struct vfp *vfp;
void *priv1;
intptr_t priv2;
+ enum vfp_status closed;
VTAILQ_ENTRY(vfp_entry) list;
};
diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index e3585fe..8a58fe1 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -114,7 +114,7 @@ vfp_suck_fini(struct busyobj *bo)
struct vfp_entry *vfe;
VTAILQ_FOREACH(vfe, &bo->vfp, list) {
- if(vfe->vfp != NULL && vfe->vfp->fini != NULL)
+ if(vfe->closed == VFP_OK && vfe->vfp->fini != NULL)
vfe->vfp->fini(bo, vfe);
}
}
@@ -134,6 +134,7 @@ vfp_suck_init(struct busyobj *bo)
"Fetch filter %s failed to initialize",
vfe->vfp->name);
vfp_suck_fini(bo);
+ vfe->closed = retval;
return (retval);
}
}
@@ -159,12 +160,7 @@ VFP_Suck(struct busyobj *bo, void *p, ssize_t *lp)
CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC);
bo->vfp_nxt = VTAILQ_NEXT(vfe, list);
- if (vfe->vfp == NULL) {
- *lp = 0;
- vp = (enum vfp_status)vfe->priv2;
- bo->vfp_nxt = vfe;
- return (vp);
- } else {
+ if (vfe->closed == VFP_OK) {
vp = vfe->vfp->pull(bo, vfe, p, lp);
if (vp == VFP_ERROR)
(void)VFP_Error(bo, "Fetch filter %s returned %d",
@@ -172,9 +168,12 @@ VFP_Suck(struct busyobj *bo, void *p, ssize_t *lp)
if (vp != VFP_OK) {
if (vfe->vfp->fini != NULL)
vfe->vfp->fini(bo, vfe);
- vfe->vfp = NULL;
- vfe->priv2 = vp;
+ vfe->closed = vp;
}
+ } else {
+ /* Already closed filter */
+ *lp = 0;
+ vp = vfe->closed;
}
bo->vfp_nxt = vfe;
return (vp);
@@ -264,6 +263,7 @@ VFP_Push(struct busyobj *bo, const struct vfp *vfp, intptr_t priv)
vfe->magic = VFP_ENTRY_MAGIC;
vfe->vfp = vfp;
vfe->priv2 = priv;
+ vfe->closed = VFP_OK;
VTAILQ_INSERT_HEAD(&bo->vfp, vfe, list);
bo->vfp_nxt = vfe;
}
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 7294439..d7f1182 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -288,6 +288,7 @@ pan_wrk(const struct worker *wrk)
static void
pan_busyobj(const struct busyobj *bo)
{
+ struct vfp_entry *vfe;
VSB_printf(pan_vsp, " busyobj = %p {\n", bo);
pan_ws(bo->ws, 4);
@@ -301,6 +302,13 @@ pan_busyobj(const struct busyobj *bo)
VSB_printf(pan_vsp, " bodystatus = %d (%s),\n",
bo->htc.body_status, body_status_2str(bo->htc.body_status));
+ if (!VTAILQ_EMPTY(&bo->vfp)) {
+ VSB_printf(pan_vsp, " filters =");
+ VTAILQ_FOREACH(vfe, &bo->vfp, list)
+ VSB_printf(pan_vsp, " %s=%d",
+ vfe->vfp->name, (int)vfe->closed);
+ VSB_printf(pan_vsp, "\n");
+ }
VSB_printf(pan_vsp, " },\n");
if (VALID_OBJ(bo->vbc, BACKEND_MAGIC))
pan_vbc(bo->vbc);
More information about the varnish-commit
mailing list