zfs panic on i386

David Malone dwmalone at maths.tcd.ie
Sun Jan 12 15:46:05 UTC 2014


I have an i386 machine running -current booting from a zfs root. I
tried to update it in December, and it panics while trying to mount
the zfs filesystem on an assertion:

	solaris assert: idx < sizeof(rt->rt_histogram)/sizeof(*rt->rt_histogram) (0xffffffffffffffff < 0x40)

This is in range_tree_stat_incr(). I did some digging, and it seems
that a large object is being added to the range tree,
range_tree_stat_incr() does this:

        uint64_t size = rs->rs_end - rs->rs_start;
        int idx = highbit(size) - 1;

But the highbit code on i386 only deals with unsigned longs on i386,
and so returns zero, leaving idx set to -1. If I fix the highbit
code to work for uint64_t (see below), then the machine can boot
successfully.

	David.

@@ -380,17 +380,18 @@
  * High order bit is 31 (or 63 in _LP64 kernel).
  */
 static __inline int
-highbit(ulong_t i)
+/*highbit(ulong_t i)*/
+highbit(uint64_t i)
 {
 	register int h = 1;
 
 	if (i == 0)
 		return (0);
-#ifdef _LP64
+/*#ifdef _LP64 */
 	if (i & 0xffffffff00000000ul) {
 		h += 32; i >>= 32;
 	}
-#endif
+/*#endif*/
 	if (i & 0xffff0000) {
 		h += 16; i >>= 16;
 	}


More information about the zfs-devel mailing list