zfs panic on i386

Andriy Gapon avg at FreeBSD.org
Mon Jan 13 07:03:24 UTC 2014


on 12/01/2014 17:46 David Malone said the following:
> 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,

thank you very much for the analysis and the patch.
I discussed the issue with the upstream and they are aware of the problem.
We are probably going to end up with a slightly different fix with explicit
highbit64() function.
Thanks again!

> @@ -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;
>  	}
> 


-- 
Andriy Gapon


More information about the zfs-devel mailing list