Commit 25d809ff authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

There is a potential lock-order inversion between a worker thread

and the ban-lurker and there is nothing we can do about it:  They
come from opposite ends of the world.

Resolve this by using a TryLock in the ban-lurker and abandon the
attempt if we fail to get the lock.

Fixes:	#796


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5432 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f47acc34
...@@ -661,7 +661,10 @@ HSH_FindBan(struct sess *sp, struct objcore **oc) ...@@ -661,7 +661,10 @@ HSH_FindBan(struct sess *sp, struct objcore **oc)
CHECK_OBJ_NOTNULL(oc1, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc1, OBJCORE_MAGIC);
oh = oc1->objhead; oh = oc1->objhead;
CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
Lck_Lock(&oh->mtx); if (Lck_Trylock(&oh->mtx)) {
*oc = NULL;
return;
}
VTAILQ_FOREACH(oc2, &oh->objcs, list) VTAILQ_FOREACH(oc2, &oh->objcs, list)
if (oc1 == oc2) if (oc1 == oc2)
break; break;
......
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