ZFS: clock_t overflow in l2arc_feed_thread

Martin Matuska mm at FreeBSD.org
Sat Jan 29 15:36:44 UTC 2011


I agree to you that we have different types and this may be an issue but
I disagree to your patch.
clock_t is not signed (int64_t) and this can be done in a much easier
(and cleaner way) without touching the code, see attached patch.

Dňa 29.01.2011 11:30, Artem Belevich wrote / napísal(a)
> Hi,
>
> I'm using ZFS v15 on RELENG_8/amd64 box. Some time back I've noticed
> that after a while ZFS starts to consume 100% of CPU time on one of
> the cores. After a bit of digging it appears that the problem is due
> to an integer overflow.
>
> On amd64 (as wel as most other FreeBSD platforms) clock_t is a signed
> 32-bit integer. On OpenSolaris clock_t is long.
>
> In compat/opensolaris/sys/time.h LBOLT is defined as
> #define      LBOLT   ((gethrtime() * hz) / NANOSEC)
>
> With HZ=1000 LBOLT overflows clock_t variables when uptime reaches
> ~24days. This affects l2arc_write_interval() which calculates the time
> when L2ARC feed thread should be woken up. The end result is that for
> the next 24 days l2arc_feed_thread no longer sleeps as long as it
> should have.
>
> Changing clock_t to a larger type globally looks somewhat risky to me.
> It's probably easier to change those few places in ZFS code that use
> clock_t to uint64_t instead.
>
> In case someone is interested, I've posted my patch here:
> http://pastebin.com/Q2T3x2AB
>
> --Artem
> _______________________________________________
> freebsd-fs at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opensolaris_types.patch
Type: text/x-patch
Size: 376 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20110129/92a23b92/opensolaris_types.bin


More information about the freebsd-fs mailing list