[6.0] ca354bdde Ensure that only the rxthread gets to use h2->cond in h2_send_get

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:53:16 UTC 2018


commit ca354bdde61b90b6e41cfbc560d75e7b90a9567a
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date:   Wed Jun 27 13:36:04 2018 +0200

    Ensure that only the rxthread gets to use h2->cond in h2_send_get
    
    Future-proofing to avoid mistakenly introducing another race down the
    line.

diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index 7c290bf9d..054796e4b 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -45,6 +45,8 @@ h2_send_get(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 
 	Lck_AssertHeld(&h2->sess->mtx);
+	if (&wrk->cond == h2->cond)
+		ASSERT_RXTHR(h2);
 	r2->wrk = wrk;
 	VTAILQ_INSERT_TAIL(&h2->txqueue, r2, tx_list);
 	while (VTAILQ_FIRST(&h2->txqueue) != r2)


More information about the varnish-commit mailing list