From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Van Assche Subject: Re: [PATCH 6/6] multipathd: Remove a busy-waiting loop Date: Wed, 17 Aug 2016 12:55:47 -0700 Message-ID: References: <31d43b64-36c8-1a24-a849-230b5cf6323c@sandisk.com> <14804b8b-51a7-e860-91d7-9b594aeed63c@sandisk.com> <2a584b4c-88b7-288b-3f89-62c565774cf1@suse.de> <7b1ac503-6f17-68b5-7510-547bd5f11731@sandisk.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Dragan Stancevic Cc: device-mapper development List-Id: dm-devel.ids 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.