[master] f42141f2d drop the probe lock while scheduling a probe
Nils Goroll
nils.goroll at uplex.de
Tue Mar 10 09:57:06 UTC 2020
commit f42141f2d99a3a6e1c34641a3778058afdf61e56
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue Mar 10 10:51:20 2020 +0100
drop the probe lock while scheduling a probe
The great witness test introduced by @bsdphk and reworked relatively
recently by @Dridi reported a hypothetical lock cycle here.
This was not a real issue, because the scheduling code would not re-enter
the probe code, yet we might still drop the probe lock while
scheduling.
diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index 8d0bc41f7..52b1871ba 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -465,6 +465,7 @@ vbp_thread(struct worker *wrk, void *priv)
{
vtim_real now, nxt;
struct vbp_target *vt;
+ int r;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AZ(priv);
@@ -486,7 +487,10 @@ vbp_thread(struct worker *wrk, void *priv)
vt->running = 1;
vt->task.func = vbp_task;
vt->task.priv = vt;
- if (Pool_Task_Any(&vt->task, TASK_QUEUE_REQ))
+ Lck_Unlock(&vbp_mtx);
+ r = Pool_Task_Any(&vt->task, TASK_QUEUE_REQ);
+ Lck_Lock(&vbp_mtx);
+ if (r)
vt->running = 0;
}
binheap_insert(vbp_heap, vt);
More information about the varnish-commit
mailing list