Re: UFS bad inode, mangled entry on Alder Lake-N(100)

From: Milan Obuch <freebsd-current_at_dino.sk>
Date: Mon, 27 Jan 2025 17:38:03 UTC
On Mon, 27 Jan 2025 12:10:43 -0500
Ian FREISLICH <ianfreislich@gmail.com> wrote:

> I recently bought one of those mini-pc firewall devices (Topton 12th
> gen N100 with 4x I226-V, 2x X520) and couldn't get it to install pkg
> or buildkernel without getting a slew of these messages, inode number
> changing and a panic shortly thereafter.
> 
> kernel: /: bad dir ino 4567815 at offset 0: mangled entry
> 
> I tried the FreeBSD-15.0-CURRENT-amd64-20250124 snapshot and
> 14.2-RELEASE, both with and without journal, trim and softupdates in
> every permitted permutation without success. The system has an NVME,
> but I experience the same problem with the install on a microsd and
> different known good NVME drive. Each time I had to reinstall because
> the filesystem was so corrupted it wouldn't boot after a fsck.
> 
> The system is now running fine with ZFS so I'm wondering if it's
> silently corrupting the ZFS or if there's a bug in UFS2 that's
> tickled by this CPU. I'll provide any debugging required.

Just a "me too" message - I did test another device with the same CPU,
mine is SZBOX. Only with 14.2-RELEASE, but I tested with both NVMe and
M.2 SATA devices, both direct in miniPC and externally via USB-NVMe and
USB-M.2 SATA converters. System installation went flawless, however,
just building ports-mgmt/pkg port was enough to start generate mangled
entry messages as you wrote.

To me it look like there is some bug in UFS code when used with this
CPU, I have no idea how such a bug could not manifest itself on another
platform - I was convinced UFS code is hardware independent, this is
really strange. I did not test with ZFS yet, I plan to do it.

So, if I can test something, patch, different setup, provide some
debugging, count me in.

Regards,
Milan