Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash: A waiting list match is a formal revalidation #4032

Closed
wants to merge 10 commits into from
3 changes: 0 additions & 3 deletions bin/varnishd/cache/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,6 @@ struct req {

struct objcore *body_oc;

/* The busy objhead we sleep on */
struct objhead *hash_objhead;

/* Built Vary string == workspace reservation */
uint8_t *vary_b;
uint8_t *vary_e;
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishd/cache/cache_ban_lurker.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
if (i)
ObjSendEvent(wrk, oc, OEV_BANCHG);
}
(void)HSH_DerefObjCore(wrk, &oc, 0);
(void)HSH_DerefObjCore(wrk, &oc);
}
}

Expand Down
3 changes: 1 addition & 2 deletions bin/varnishd/cache/cache_busyobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ VBO_ReleaseBusyObj(struct worker *wrk, struct busyobj **pbo)
wrk->stats->ws_backend_overflow++;

if (bo->fetch_objcore != NULL) {
(void)HSH_DerefObjCore(wrk, &bo->fetch_objcore,
HSH_RUSH_POLICY);
(void)HSH_DerefObjCore(wrk, &bo->fetch_objcore);
}

VRT_Assign_Backend(&bo->director_req, NULL);
Expand Down
6 changes: 3 additions & 3 deletions bin/varnishd/cache/cache_expire.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ EXP_Insert(struct worker *wrk, struct objcore *oc)
ObjSendEvent(wrk, oc, OEV_EXPIRE);
tmpoc = oc;
assert(oc->refcnt >= 2); /* Silence coverity */
(void)HSH_DerefObjCore(wrk, &oc, 0);
(void)HSH_DerefObjCore(wrk, &oc);
AZ(oc);
assert(tmpoc->refcnt >= 1); /* Silence coverity */
}
Expand Down Expand Up @@ -287,7 +287,7 @@ exp_inbox(struct exp_priv *ep, struct objcore *oc, unsigned flags, double now)
VXID(ObjGetXID(ep->wrk, oc)), EXP_Ttl(NULL, oc) - now,
(intmax_t)oc->hits);
ObjSendEvent(ep->wrk, oc, OEV_EXPIRE);
(void)HSH_DerefObjCore(ep->wrk, &oc, 0);
(void)HSH_DerefObjCore(ep->wrk, &oc);
return;
}

Expand Down Expand Up @@ -365,7 +365,7 @@ exp_expire(struct exp_priv *ep, vtim_real now)
VXID(ObjGetXID(ep->wrk, oc)), EXP_Ttl(NULL, oc) - now,
(intmax_t)oc->hits);
ObjSendEvent(ep->wrk, oc, OEV_EXPIRE);
(void)HSH_DerefObjCore(ep->wrk, &oc, 0);
(void)HSH_DerefObjCore(ep->wrk, &oc);
}
return (0);
}
Expand Down
38 changes: 12 additions & 26 deletions bin/varnishd/cache/cache_fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,8 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)

assert(oc->boc->state == BOS_REQ_DONE);

if (bo->do_stream) {
ObjSetState(wrk, oc, BOS_PREP_STREAM);
HSH_Unbusy(wrk, oc);
if (bo->do_stream)
ObjSetState(wrk, oc, BOS_STREAM);
}

VSLb(bo->vsl, SLT_Fetch_Body, "%u %s %s",
bo->htc->body_status->nbr, bo->htc->body_status->name,
Expand Down Expand Up @@ -744,11 +741,8 @@ vbf_stp_fetchend(struct worker *wrk, struct busyobj *bo)

if (bo->do_stream)
assert(oc->boc->state == BOS_STREAM);
else {
else
assert(oc->boc->state == BOS_REQ_DONE);
ObjSetState(wrk, oc, BOS_PREP_STREAM);
HSH_Unbusy(wrk, oc);
}

ObjSetState(wrk, oc, BOS_FINISHED);
VSLb_ts_busyobj(bo, "BerespBody", W_TIM_real(wrk));
Expand Down Expand Up @@ -877,11 +871,8 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
ObjSetFlag(bo->wrk, oc, OF_IMSCAND, 0);
AZ(ObjCopyAttr(bo->wrk, oc, stale_oc, OA_GZIPBITS));

if (bo->do_stream) {
ObjSetState(wrk, oc, BOS_PREP_STREAM);
HSH_Unbusy(wrk, oc);
if (bo->do_stream)
ObjSetState(wrk, oc, BOS_STREAM);
}

INIT_OBJ(vop, VBF_OBITER_PRIV_MAGIC);
vop->bo = bo;
Expand Down Expand Up @@ -1025,8 +1016,7 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
}
AZ(ObjSetU64(wrk, oc, OA_LEN, o));
VSB_destroy(&synth_body);
ObjSetState(wrk, oc, BOS_PREP_STREAM);
HSH_Unbusy(wrk, oc);
ObjSetState(wrk, oc, BOS_STREAM);
if (stale != NULL && oc->ttl > 0)
HSH_Kill(stale);
ObjSetState(wrk, oc, BOS_FINISHED);
Expand All @@ -1047,10 +1037,8 @@ vbf_stp_fail(struct worker *wrk, struct busyobj *bo)
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);

assert(oc->boc->state < BOS_FINISHED);
HSH_Fail(oc);
if (!(oc->flags & OC_F_BUSY))
dridi marked this conversation as resolved.
Show resolved Hide resolved
HSH_Kill(oc);
ObjSetState(wrk, oc, BOS_FAILED);
HSH_Kill(oc);
return (F_STP_DONE);
}

Expand Down Expand Up @@ -1122,7 +1110,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
http_Teardown(bo->beresp);
// can not make assumptions about the number of references here #3434
if (bo->bereq_body != NULL)
(void) HSH_DerefObjCore(bo->wrk, &bo->bereq_body, 0);
(void)HSH_DerefObjCore(bo->wrk, &bo->bereq_body);

if (oc->boc->state == BOS_FINISHED) {
AZ(oc->flags & OC_F_FAILED);
Expand All @@ -1132,7 +1120,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
// AZ(oc->boc); // XXX

if (bo->stale_oc != NULL)
(void)HSH_DerefObjCore(wrk, &bo->stale_oc, 0);
(void)HSH_DerefObjCore(wrk, &bo->stale_oc);

wrk->vsl = NULL;
HSH_DerefBoc(wrk, oc);
Expand Down Expand Up @@ -1221,7 +1209,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
wrk->stats->bgfetch_no_thread++;
(void)vbf_stp_fail(req->wrk, bo);
if (bo->stale_oc != NULL)
(void)HSH_DerefObjCore(wrk, &bo->stale_oc, 0);
(void)HSH_DerefObjCore(wrk, &bo->stale_oc);
HSH_DerefBoc(wrk, oc);
SES_Rel(bo->sp);
THR_SetBusyobj(NULL);
Expand All @@ -1234,17 +1222,15 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
(void)VRB_Ignore(req);
} else {
ObjWaitState(oc, BOS_STREAM);
if (oc->boc->state == BOS_FAILED) {
AN((oc->flags & OC_F_FAILED));
} else {
AZ(oc->flags & OC_F_BUSY);
}
AZ(oc->flags & OC_F_BUSY);
if (oc->boc->state == BOS_FAILED)
AN(oc->flags & OC_F_FAILED);
}
}
AZ(bo);
VSLb_ts_req(req, "Fetch", W_TIM_real(wrk));
assert(oc->boc == boc);
HSH_DerefBoc(wrk, oc);
if (mode == VBF_BACKGROUND)
(void)HSH_DerefObjCore(wrk, &oc, HSH_RUSH_POLICY);
(void)HSH_DerefObjCore(wrk, &oc);
}
Loading