Commit 2026f147 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Resolve the remove/lookup race the simple way.



git-svn-id: http://www.varnish-cache.org/svn/trunk@3456 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f226dd36
......@@ -364,6 +364,7 @@ static struct objhead *
hcb_lookup(const struct sess *sp, struct objhead *noh)
{
struct objhead *oh;
unsigned u;
assert(params->hash_sha256);
oh = hcb_insert(&hcb_root, noh, 0);
......@@ -371,14 +372,14 @@ hcb_lookup(const struct sess *sp, struct objhead *noh)
/* Assert that we didn't muck with the tree without lock */
assert(oh != noh);
Lck_Lock(&oh->mtx);
oh->refcnt++;
u = oh->refcnt;
if (u)
oh->refcnt++;
Lck_Unlock(&oh->mtx);
VSL_stats->hcb_nolock++;
if (0) {
fprintf(stderr, "%s %d\n", __func__, __LINE__);
dump(&hcb_root, stderr);
if (u) {
VSL_stats->hcb_nolock++;
return (oh);
}
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