On Thu, Nov 12, 2026 at 09:03:10PM +0530, Ganesh Andhale wrote:
> cleanup_global_uevq() and cleanup_global_purge_queue() were registered
> as pthread cleanup handlers in worker threads. During shutdown, these
> handlers could run as soon as their owning thread was cancelled, while
> another thread that also accessed the same global queue had not been
> joined yet.
>
> This allowed the global uevent or purge queue to be cleaned while a
> producer or consumer thread could still touch it.
>
> Move the global queue cleanup to cleanup_queues(), which is called
> after cleanup_threads(), once all related threads have been joined.
> Keep the pthread cleanup handlers only for thread-local temporary lists
> and other resources owned by the cancelling thread.
>
> Export cleanup_global_uevq() from libmultipath so multipathd can call
> it during daemon shutdown.
>
> Signed-off-by: Ganesh Andhale <[email protected]>
Reviewed-by: Benjamin Marzinski <[email protected]>