[master] afed0f6 Let req_fsm deref its own bo->ref on failure
Poul-Henning Kamp
phk at varnish-cache.org
Mon May 20 15:28:50 CEST 2013
commit afed0f6143e39961d2156bf4172d7c17351daa46
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon May 20 13:28:35 2013 +0000
Let req_fsm deref its own bo->ref on failure
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 3e88210..51b3d4f 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -753,7 +753,6 @@ cnt_fetch(struct worker *wrk, struct req *req, struct busyobj *bo)
assert(bo->refcount == 2);
bo->storage_hint = NULL;
VBO_DerefBusyObj(wrk, &bo);
- VBO_DerefBusyObj(wrk, &req->busyobj);
req->director = NULL;
switch (wrk->handling) {
@@ -881,7 +880,6 @@ VBF_Fetch(struct worker *wrk, struct req *req)
AZ(HSH_Deref(&wrk->stats, req->objcore, NULL));
req->objcore = NULL;
VDI_CloseFd(&bo->vbc);
- VBO_DerefBusyObj(wrk, &req->busyobj);
return (-1);
} else
/* No vary */
@@ -919,7 +917,6 @@ VBF_Fetch(struct worker *wrk, struct req *req)
AZ(HSH_Deref(&wrk->stats, req->objcore, NULL));
req->objcore = NULL;
VDI_CloseFd(&bo->vbc);
- VBO_DerefBusyObj(wrk, &req->busyobj);
return (-1);
}
CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
@@ -996,7 +993,6 @@ VBF_Fetch(struct worker *wrk, struct req *req)
} else if (bo->state == BOS_FAILED) {
/* handle early failures */
(void)HSH_Deref(&wrk->stats, NULL, &req->obj);
- VBO_DerefBusyObj(wrk, &req->busyobj);
return (-1);
}
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 04e3415..9a4e27d 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -356,14 +356,17 @@ cnt_fetch(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
i = VBF_Fetch(wrk, req);
- if (i < 0) {
+ if (i == 0) {
+ assert(WRW_IsReleased(wrk));
+ req->req_step = R_STP_PREPRESP;
+ } else if (i < 0) {
+ VBO_DerefBusyObj(wrk, &req->busyobj);
req->err_code = 503;
req->req_step = R_STP_ERROR;
- } else if (i == 1) {
- req->req_step = R_STP_RESTART;
} else {
- assert(WRW_IsReleased(wrk));
- req->req_step = R_STP_PREPRESP;
+ VBO_DerefBusyObj(wrk, &req->busyobj);
+ assert(i == 1);
+ req->req_step = R_STP_RESTART;
}
return (REQ_FSM_MORE);
}
More information about the varnish-commit
mailing list