[master] 94a3d07 Close race on req->wrk clearing introduced in 6f2e1bcd

Martin Blix Grydeland martin at varnish-software.com
Mon Apr 28 15:27:01 CEST 2014


commit 94a3d071b66d4f7aa7f94660cad42e4d58f25724
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Apr 28 15:19:15 2014 +0200

    Close race on req->wrk clearing introduced in 6f2e1bcd
    
    The disembarking thread would clear the req->wrk pointer in
    CNT_Request. The req could have already been rescheduled on another
    worker at this point, causing the req->wrk to be cleared while
    processing. Change back to not clearing the pointer for
    REQ_FSM_DISEMBARK (it's already been done under mutex in HSH_Lookup
    anyways).
    
    Fixes: #1488

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index d12f91c..d465ba4 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -913,8 +913,8 @@ CNT_Request(struct worker *wrk, struct req *req)
 			VTAILQ_REMOVE(&req->body, st, list);
 			STV_free(st);
 		}
+		req->wrk = NULL;
 	}
-	req->wrk = NULL;
 	assert(WRW_IsReleased(wrk));
 	return (nxt);
 }



More information about the varnish-commit mailing list