[master] d9c9c13 Turn vcl_pass{} into a "last chance to restart/error before fetch" decision point.
Poul-Henning Kamp
phk at varnish-cache.org
Fri May 17 09:26:56 CEST 2013
commit d9c9c13d41a123642e612163450cac156618decb
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri May 17 07:26:22 2013 +0000
Turn vcl_pass{} into a "last chance to restart/error before fetch"
decision point.
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index bb18117..77f357e 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -768,6 +768,16 @@ cnt_pass(struct worker *wrk, struct req *req)
AZ(req->obj);
AZ(req->busyobj);
+ VCL_pass_method(req->vcl, wrk, req, NULL, req->http->ws);
+ if (wrk->handling == VCL_RET_ERROR) {
+ req->req_step = R_STP_ERROR;
+ return (REQ_FSM_MORE);
+ }
+ if (wrk->handling == VCL_RET_RESTART) {
+ INCOMPL();
+ }
+ assert (wrk->handling == VCL_RET_FETCH);
+
req->busyobj = VBO_GetBusyObj(wrk, req);
bo = req->busyobj;
bo->refcount = 2;
@@ -777,15 +787,8 @@ cnt_pass(struct worker *wrk, struct req *req)
"X-Varnish: %u", req->vsl->wid & VSL_IDENTMASK);
VCL_backend_fetch_method(bo->vcl, wrk, NULL, bo, bo->bereq->ws);
- VCL_pass_method(bo->vcl, wrk, req, bo, bo->bereq->ws);
- if (wrk->handling == VCL_RET_ERROR) {
- http_Teardown(bo->bereq);
- VBO_DerefBusyObj(wrk, &req->busyobj);
- req->req_step = R_STP_ERROR;
- return (REQ_FSM_MORE);
- }
- assert(wrk->handling == VCL_RET_PASS);
+ assert (wrk->handling == VCL_RET_FETCH);
req->acct_req.pass++;
req->req_step = R_STP_FETCH;
diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl
index 488cf0c..520bc06 100644
--- a/bin/varnishd/default.vcl
+++ b/bin/varnishd/default.vcl
@@ -80,7 +80,7 @@ sub vcl_pipe {
}
sub vcl_pass {
- return (pass);
+ return (fetch);
}
sub vcl_hash {
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 1402e13..7671650 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -80,7 +80,7 @@ tokens = {
returns =(
('recv', "C", ('error', 'pass', 'pipe', 'hash', 'purge',)),
('pipe', "C", ('error', 'pipe',)),
- ('pass', "C", ('error', 'restart', 'pass',)),
+ ('pass', "C", ('error', 'restart', 'fetch',)),
('hash', "C", ('lookup',)),
('purge', "C", ('error', 'fetch',)),
('miss', "C", ('error', 'restart', 'pass', 'fetch',)),
More information about the varnish-commit
mailing list