[Linux-HA] [patch] clock_t wrapped aroundcausingfalse resourcestart failure

Tavanyar, Simon Simon.Tavanyar at stratus.com
Sun Jul 5 16:09:13 MDT 2009


This looks like a very hard bug to reproduce. I'm reluctantly going to
recommend "Ignore for now". 


-----Original Message-----
From: linux-ha-bounces at lists.linux-ha.org
[mailto:linux-ha-bounces at lists.linux-ha.org] On Behalf Of Lars Ellenberg
Sent: Thursday, July 02, 2009 8:17 AM
To: linux-ha at lists.linux-ha.org
Subject: Re: [Linux-HA] [patch] clock_t wrapped aroundcausingfalse
resourcestart failure

On Thu, Jul 02, 2009 at 11:00:08AM +0200, Dejan Muhamedagic wrote:
> >         if (cmp_longclock(lnow, append->nexttime) >= 0)
> > assuming that nexttime was set correctly, and lnow is correct, too,
> > and further assuming your clock_t is only 32 bit,
> > longclock_t is defined as unsigned long long,
> > and that thing becomes:
> > 
> >         if ((unsigned long long)(lnow) >= (unsigned long
long)(append->nexttime))
> > 
> > which exactly does _NOT_ care for wrap around :(
> > 
> > 
> > example:
> > 	say, you start with a _large_ lnow (e.g. the equivalent of "-15
> 
> But you can't start with large lnow. lnow is 64-bit and you can't
> get that far into the future.

Hm. Right.

Then maybe something else is wrong, like some wrong typecast?
int i = -300000;
unsigned long long l_wrong = i;
unsigned long long l_right = (unsigned long long)(unsigned int)i;

l_wrong is now "very far" into the future,
and my patch would fix the comparison of that.

whereas l_right is just below 2<<32, and will compare fine in 64 bit
wide unsigned long long, with the existing code.

Simon: can you help to track this down?  Which exact "platform" is this
on, heartbeat version, configure and compiler flags...
You could also try to start this in a VM, and try to reproduce?

Or shall we just ignore this for now?

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD(r) and LINBIT(r) are registered trademarks of LINBIT, Austria.
_______________________________________________
Linux-HA mailing list
Linux-HA at lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems



More information about the Linux-HA mailing list