Commit 128fbe7c authored by Nils Goroll's avatar Nils Goroll

ban lurker should back off on seeing a busy object

HSH_Unbusy() calls BAN_NewObjCore() not holding the objhead
lock, so the ban lurker may race and grab the ban mtx just
after the new oc has been inserted, but the busy flag not
yet cleared.

While it would be correct to call BAN_NewObjCore() with the
objhead mtx held, doing so would increase the pressure on the
combined ban & objhead mtx.

If the ban lurker encounters a busy object, we know that there
must be an unbusy in progress and it would be wiser to rather
back off in favor of the it.

Fixes #2681
parent ff86ca7e
......@@ -167,7 +167,7 @@ ban_lurker_getfirst(struct vsl_log *vsl, struct ban *bt)
oh = oc->objhead;
CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
if (!Lck_Trylock(&oh->mtx)) {
if (oc->refcnt == 0) {
if (oc->refcnt == 0 || oc->flags & OC_F_BUSY) {
Lck_Unlock(&oh->mtx);
} else {
/*
......
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