[master] c709e11 Polish the stale_oc management a little bit.

Poul-Henning Kamp phk at FreeBSD.org
Wed Sep 16 23:31:58 CEST 2015


commit c709e110d4e1c70052caae366b8777e87490a8e0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Sep 16 20:40:41 2015 +0000

    Polish the stale_oc management a little bit.

diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 00193ec..78e2512 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -185,6 +185,7 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
 		return;
 
 	AZ(bo->htc);
+	AZ(bo->stale_oc);
 
 	VRTPRIV_dynamic_kill(bo->privs, (uintptr_t)bo);
 	assert(VTAILQ_EMPTY(&bo->privs->privs));
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 539fee1..a69862f 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -186,8 +186,7 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo)
 	} else
 		AZ(bo->stale_oc);
 
-	if (bo->stale_oc != NULL &&
-	    ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) {
+	if (bo->stale_oc != NULL) {
 		q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified);
 		if (q != NULL)
 			http_PrintfHeader(bo->bereq0,
@@ -394,8 +393,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	AZ(bo->was_304);
 
 	if (http_IsStatus(bo->beresp, 304)) {
-		if (bo->stale_oc != NULL &&
-		    ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) {
+		if (bo->stale_oc != NULL) {
 			if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) {
 				/*
 				 * If we changed the gzip status of the object
@@ -906,6 +904,13 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 	bo->wrk = wrk;
 	wrk->vsl = bo->vsl;
 
+	if (bo->stale_oc != NULL) {
+		CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC);
+		/* We don't want the oc/stevedore ops in fetching thread */
+		if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND))
+			(void)HSH_DerefObjCore(wrk, &bo->stale_oc);
+	}
+
 	while (stp != F_STP_DONE) {
 		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 		assert(bo->refcount >= 1);
@@ -937,7 +942,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 	if (bo->stale_oc != NULL)
 		(void)HSH_DerefObjCore(wrk, &bo->stale_oc);
 
-
 	wrk->vsl = NULL;
 	VBO_DerefBusyObj(wrk, &bo);
 	THR_SetBusyobj(NULL);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index abd6685..b7afe84 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -60,7 +60,7 @@ cnt_vdp(struct req *req, struct busyobj *bo)
 	resp_len = http_GetContentLength(req->resp);
 	if (bo != NULL)
 		req->resp_len = resp_len;
-	else 
+	else
 		req->resp_len = ObjGetLen(req->wrk, req->objcore);
 
 	req->res_mode = 0;



More information about the varnish-commit mailing list