[master] 2c16067 Clear the req->wrk while holding the oh mutex, to close a race against the busy-list.

Poul-Henning Kamp phk at varnish-cache.org
Mon Sep 16 11:14:31 CEST 2013


commit 2c1606779d86b5afee891465031f4f159b3e29d6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 16 09:13:39 2013 +0000

    Clear the req->wrk while holding the oh mutex, to close a race
    against the busy-list.
    
    Fixes #1342

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index b653d50..e2959fe 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -494,13 +494,14 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
 		    req, w_list);
 		if (DO_DEBUG(DBG_WAITINGLIST))
 			VSLb(req->vsl, SLT_Debug, "on waiting list <%p>", oh);
+		req->wrk = NULL;
 	} else {
 		if (DO_DEBUG(DBG_WAITINGLIST))
 			VSLb(req->vsl, SLT_Debug, "hit busy obj <%p>", oh);
 	}
 
 	wrk->stats.busy_sleep++;
-	SES_Charge(req->wrk, req);
+	SES_Charge(wrk, req);
 	/*
 	 * The objhead reference transfers to the sess, we get it
 	 * back when the sess comes off the waiting list and



More information about the varnish-commit mailing list