[master] 525ff0e7b cleanup implicit rollback for return(vcl(...))

Nils Goroll nils.goroll at uplex.de
Mon Dec 2 13:18:06 UTC 2019


commit 525ff0e7b00939538f1b3a4ce1f4e61f3dee44f2
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Nov 13 12:06:55 2019 +0100

    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.

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 154679a19..f4067c1d8 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.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);
 	}
diff --git a/bin/varnishd/cache/cache_vpi.c b/bin/varnishd/cache/cache_vpi.c
index 8a345ba41..b80f4be04 100644
--- a/bin/varnishd/cache/cache_vpi.c
+++ b/bin/varnishd/cache/cache_vpi.c
@@ -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);
 }


More information about the varnish-commit mailing list