[dm-devel] [PATCH 6/6] multipathd: Remove a busy-waiting loop

Bart Van Assche bart.vanassche at sandisk.com
Wed Aug 17 19:55:47 UTC 2016


On 08/17/2016 12:42 PM, Dragan Stancevic wrote:
> Hi Bart-
>
> are the semantics below really safe, the don't appear to? Any caller of
> checker_thread_running is relaying on stale information. The
> c->thread_running could have changed as soon as you unlock.
>
> +static unsigned checker_thread_running(struct tur_checker_context *ct)
> +{
> +unsigned thread_running;
> +
> +pthread_spin_lock(&ct->hldr_lock);
> +thread_running = ct->thread_running;
> +pthread_spin_unlock(&ct->hldr_lock);
> +
> +return thread_running;
> +}

Hello Dragan,

If you have a look at libcheck_check() in tur.c then you will see that 
it is harmless if checker_thread_running() returns old information.

Bart.





More information about the dm-devel mailing list