ZFS: clock_t overflow in l2arc_feed_thread

Artem Belevich fbsdlist at src.cx
Mon Jan 31 09:03:56 UTC 2011


On Sun, Jan 30, 2011 at 9:25 PM, Bruce Evans <brde at optusnet.com.au> wrote:
> On Mon, 31 Jan 2011, Martin Matuska wrote:
>
>> I have re-checked OpenSolaris, and discovered that long is a int32_t.

Not true. It's 'long' which would be int64_t on LP64 and int32_t on ILP32
http://src.opensolaris.org/source/search?q=&project=onnv&defs=clock_t&refs=&path=&hist=

> Why be different from both OpenSolaris and FreeBSD?  clock_t is 32 bits
> on all, and only bogusly signed on some.

See above.

> Also, there must be another bug for overflow to occur after only 24 days.
> clock_t is only specified for holding statclock ticks, which have a
> frequency of about 128 Hz, so 32-bit unsigned ints hold 388 days of ticks.

clock_t is used in solaris code to hold LBOLT (rough equivalent of
*uptime() in FreeBSD). When the code was ported to FreeBSD, LBOLT was
implemented so that it holds uptime in HZ ticks. HZ happens to be
1000, so clock_t as implemented on FreeBSD will overflow in 24 days.


--Artem


More information about the freebsd-fs mailing list