Commit a4118f08 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Merge r5304: Remove bogus assert

After considerable thinking, I have come to the conclusion that this
assert is bogus.

There is a window from our lookup until we lock the refcount where
a different thread conceiveably could loose the last reference to
the objhdr, before we get the lock to increase it.

The situation the assert was meant to protect, where we insert 
a new objhdr, is handled in the "oh == noh" clause earlier, were
the weaker "> 0" check is used (rather than "== 1") to cater for
the exact same race.

Fixes: #761
Fixes: #783



git-svn-id: http://www.varnish-cache.org/svn/branches/2.1@5368 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f6c12993
......@@ -469,12 +469,10 @@ hcb_lookup(const struct sess *sp, struct objhead *noh)
* under us, so fall through and try with the lock held.
*/
u = oh->refcnt;
if (u > 0) {
if (u > 0)
oh->refcnt++;
} else {
assert(!with_lock);
else
with_lock = 1;
}
Lck_Unlock(&oh->mtx);
if (u > 0)
return (oh);
......
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