Skip to content
Permalink
Browse files

cleanup implicit rollback for return(vcl(...))

VCC generates a call to VPI_vcl_select() before returning to the fsm. We
basically conducted half a rollback in VPI_vcl_slect and a rull rollback
in the fsm.

De-duplicate this dance and assert in the fsm that our request looks
rolled back.
  • Loading branch information...
nigoroll committed Nov 13, 2019
1 parent fd7c8bf commit 525ff0e7b00939538f1b3a4ce1f4e61f3dee44f2
Showing with 4 additions and 9 deletions.
  1. +2 −1 bin/varnishd/cache/cache_req_fsm.c
  2. +2 −8 bin/varnishd/cache/cache_vpi.c
@@ -879,7 +879,8 @@ cnt_recv(struct worker *wrk, struct req *req)

VCL_recv_method(req->vcl, wrk, req, NULL, NULL);
if (wrk->handling == VCL_RET_VCL && req->restarts == 0) {
Req_Rollback(req);
// Req_Rollback has happened in VPI_vcl_select
assert(WS_Snapshot(req->ws) == req->ws_req);
cnt_recv_prep(req, ci);
VCL_recv_method(req->vcl, wrk, req, NULL, NULL);
}
@@ -99,12 +99,8 @@ VPI_vcl_select(VRT_CTX, VCL_VCL vcl)
if (! IS_TOPREQ(req))
assert(req->vcl == req->top->vcl0);

/* XXX VCL_Task* are somewhat duplicated to those in Req_Rollback called
* from FSM for VCL_RET_VCL. Keeping them here to ensure there are no
* tasks during calls to VCL_Rel / vcl_get
*/
VCL_TaskLeave(req->top->privs);
VCL_TaskLeave(req->privs);
Req_Rollback(req);

if (IS_TOPREQ(req)) {
AN(req->top);
AZ(req->top->vcl0);
@@ -116,6 +112,4 @@ VPI_vcl_select(VRT_CTX, VCL_VCL vcl)
vcl_get(&req->vcl, vcl);
VSLb(ctx->req->vsl, SLT_VCL_use, "%s via %s",
req->vcl->loaded_name, vcl->loaded_name);
VCL_TaskEnter(req->privs);
VCL_TaskEnter(req->top->privs);
}

0 comments on commit 525ff0e

Please sign in to comment.
You can’t perform that action at this time.