[master] 2cba061d8 Don't increment the contested counter until we have the lock.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Feb 11 11:34:09 UTC 2019
commit 2cba061d8d47934af1226b2c87701324d6b84cee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 11 11:32:51 2019 +0000
Don't increment the contested counter until we have the lock.
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index fba7e03a2..4021166e4 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -114,14 +114,13 @@ Lck__Lock(struct lock *lck, const char *p, int l)
Lck_Witness_Lock(ilck, p, l, "");
if (DO_DEBUG(DBG_LCK)) {
r = pthread_mutex_trylock(&ilck->mtx);
- if (r == EBUSY)
- ilck->stat->dbg_busy++;
- else
- AZ(r);
+ assert(r == 0 || r == EBUSY);
}
if (r)
AZ(pthread_mutex_lock(&ilck->mtx));
AZ(ilck->held);
+ if (r == EBUSY)
+ ilck->stat->dbg_busy++;
ilck->stat->locks++;
ilck->owner = pthread_self();
ilck->held = 1;
More information about the varnish-commit
mailing list