Commit bea2939c authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Dridi Boukelmoune

Set be->cooled while holding backends_mtx

Several functions (VBE_Poll and vbe_destroy) tests be->cooled == 0 to
determine which of the two lists backends and cool_backends a specific
instance currently lives on. If the flag is in the process of being
changed, then the wrong list head may be used and will result in strange
bugs.
parent d9d22f35
......@@ -653,9 +653,9 @@ VRT_delete_backend(VRT_CTX, VCL_BACKEND *dp)
CAST_OBJ_NOTNULL(be, d->priv, BACKEND_MAGIC);
Lck_Lock(&be->mtx);
VRT_DisableDirector(be->director);
be->cooled = VTIM_real() + 60.;
Lck_Unlock(&be->mtx);
Lck_Lock(&backends_mtx);
be->cooled = VTIM_real() + 60.;
VTAILQ_REMOVE(&backends, be, list);
VTAILQ_INSERT_TAIL(&cool_backends, be, list);
Lck_Unlock(&backends_mtx);
......
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