[dm-devel] [PATCH] multipathd daemon: Fix incorrect use of CLOCK_MONOTONIC in pthread

Gris Ge fge at redhat.com
Wed Aug 9 16:19:19 UTC 2017


On Wed, Aug 09, 2017 at 03:03:00PM +0000, Bart Van Assche wrote:
> > diff --git a/multipathd/main.c b/multipathd/main.c
> > index 4be2c579..67997d08 100644
> > --- a/multipathd/main.c
> > +++ b/multipathd/main.c
> > @@ -198,7 +198,7 @@ int set_config_state(enum daemon_status state)
> >  		if (running_state != DAEMON_IDLE) {
> >  			struct timespec ts;
> >  
> > -			clock_gettime(CLOCK_MONOTONIC, &ts);
> > +			clock_gettime(CLOCK_REALTIME, &ts);
> >  			ts.tv_sec += 1;
> >  			rc = pthread_cond_timedwait(&config_cond,
> >  						    &config_lock, &ts);
> 
> But this change looks wrong to me. Have you noticed that
> pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) is used to make
> config_cond use the monotonic clock? See also libmultipath/time-util.c.
> 
> Bart.
Hi Bart,

I missed the pthread_cond_init_mono().
Will send V2 patch without this change.

Thanks.

-- 
Gris Ge
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20170810/cd2a429e/attachment.sig>


More information about the dm-devel mailing list