Commit b135934f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix a race when we Unbusy and abandonned oc which has no object.

Fixes	#1449
parent e177b462
......@@ -682,10 +682,9 @@ vbf_stp_fail(struct worker *wrk, struct busyobj *bo)
CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC);
assert(bo->state < BOS_FINISHED);
bo->fetch_objcore->flags |= OC_F_PRIVATE;
HSH_Fail(bo->fetch_objcore);
if (bo->fetch_objcore->flags & OC_F_BUSY)
HSH_Unbusy(&wrk->stats, bo->fetch_objcore);
HSH_Fail(bo->fetch_objcore);
wrk->stats.fetch_failed++;
VBO_setstate(bo, BOS_FAILED);
return (F_STP_DONE);
......
......@@ -629,6 +629,13 @@ HSH_Fail(struct objcore *oc)
oh = oc->objhead;
CHECK_OBJ(oh, OBJHEAD_MAGIC);
/*
* We have to have either a busy bit, so that HSH_Lookup
* will not consider this oc, or an object hung of the oc
* so that it can consider it.
*/
assert((oc->flags & OC_F_BUSY) || (oc->methods != NULL));
Lck_Lock(&oh->mtx);
oc->flags |= OC_F_FAILED;
Lck_Unlock(&oh->mtx);
......@@ -678,7 +685,7 @@ HSH_Unbusy(struct dstat *ds, struct objcore *oc)
if (oh->waitinglist != NULL)
hsh_rush(ds, oh);
Lck_Unlock(&oh->mtx);
if (!(oc->flags & OC_F_PRIVATE)) {
if (!(oc->flags & OC_F_PRIVATE) && oc->methods != NULL) {
BAN_NewObjCore(oc);
EXP_Insert(oc);
AN(oc->flags & OC_F_EXP);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment