nit in hcb_deref?
Nils Goroll
slink at schokola.de
Tue May 6 15:16:12 CEST 2014
Trying to understand if I race a saw in 2.0.x still exists in master, I reviewed
some of the cash_hash.c and hash_*.c code.
The issue I feared could exist seems not to, but I believe I spottet a little nit:
* HSH_DeleteObjHead is only called if hash_deref(oh) returned 0
- hcb_deref always returns 1, so for hcb we never call
Lck_Delete(&oh->mtx);
ds->n_objecthead--;
FREE_OBJ(oh);
looks like a resource leak to me
simple fix IMHO:
diff --git a/bin/varnishd/hash/hash_critbit.c b/bin/varnishd/hash/hash_critbit.c
index 4e14bdd..d27e3ce 100644
--- a/bin/varnishd/hash/hash_critbit.c
+++ b/bin/varnishd/hash/hash_critbit.c
@@ -408,6 +408,7 @@ hcb_deref(struct objhead *oh)
Lck_Unlock(&hcb_mtx);
assert(VTAILQ_EMPTY(&oh->objcs));
AZ(oh->waitinglist);
+ r = 0;
}
Lck_Unlock(&oh->mtx);
#ifdef PHK
- hsl_deref / hcl_deref look ok to me
Nils
More information about the varnish-dev
mailing list