> 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.

The consumers of these lists take/hold the respective locks. So no
race would be possible, AFAICT.

If you don't mind, I'll modify the commit message accordingly before applying.

> 
> 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: Martin Wilck <[email protected]>

-- 
Martin Wilck <[email protected]>

Reply via email to