[master] 2387054 Latch error values returned from any VDP function, making sure that all subsequent calls to VDP_bytes() becomes noops. This allows calling code to allow calling VDP_bytes() again even if a previous call returned error.
Poul-Henning Kamp
phk at FreeBSD.org
Wed Apr 29 11:44:40 CEST 2015
commit 238705413c44c21c5ec91e890e34e1b0c1331066
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Apr 29 09:42:50 2015 +0000
Latch error values returned from any VDP function, making sure that
all subsequent calls to VDP_bytes() becomes noops. This allows calling
code to allow calling VDP_bytes() again even if a previous call
returned error.
Submitted by: Martin
Fixes #1642
PS: I have given up writing a test-case /phk
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index e2207c0..b9c1dd7 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -616,6 +616,7 @@ struct req {
/* Deliver pipeline */
struct vdp_entry_s vdp;
struct vdp_entry *vdp_nxt;
+ unsigned vdp_errval;
/* Transaction VSL buffer */
struct vsl_log vsl[1];
diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index a3701a9..a74b41f 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -40,6 +40,8 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
assert(act == VDP_NULL || act == VDP_FLUSH);
+ if (req->vdp_errval)
+ return (req->vdp_errval);
vdp = req->vdp_nxt;
CHECK_OBJ_NOTNULL(vdp, VDP_ENTRY_MAGIC);
req->vdp_nxt = VTAILQ_NEXT(vdp, list);
@@ -47,6 +49,8 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
assert(act > VDP_NULL || len > 0);
/* Call the present layer, while pointing to the next layer down */
retval = vdp->func(req, act, &vdp->priv, ptr, len);
+ if (retval)
+ req->vdp_errval = retval; /* Latch error value */
req->vdp_nxt = vdp;
return (retval);
}
More information about the varnish-commit
mailing list