On Thu, Nov 27, 2025, 10:22 PM FreeBSD User <[email protected]> wrote:

> On Tue, 25 Nov 2025 21:03:01 -0700
> Warner Losh <[email protected]> wrote:
>
> > On Sun, Nov 23, 2025 at 7:15 AM A FreeBSD User <[email protected]>
> > wrote:
> >
> > > Hello,
> > >
> > > running FreeBSD 16.0-CURRENT #4 master-n282101-c8cf5a99f82b: Sun Nov 23
> > > 13:56:23 CET
> > > 2025 amd64 I'm running into a serious problem when mounting an ext2fs
> > > formated USB Flash
> > > device (512GB). The devince contains files written by a Linux system,
> > > mounting the USB Flash
> > > via extended4fs, the size of the written datafiles is > 128GB. Deleting
> > > those files larger
> > > than some 20GB results in an I/O error reported by FReeBSD (# sudo rm
> > > /mnt/USB/filename).
> > > Unmounting the ext2fs after deletion (sudo umount /mnt) results in a
> total
> > > freeze of the box.
> > > No crash, no core dump, nothing. I waited almost an hour hoping for
> > > recover. I have to
> > > physically switch off the box.
> > >
> > > I checked with other USB flash I have at hand, one Samsung 256 GB, ZFS
> -
> > > no problem, another
> > > 128GB, UFS, no problem and several much smaller (4 - 64GB) with FAT or
> UFS
> > > filesystems, all no
> > > problem.
> > >
> > > I can not figure out whether it is the USB flash drive itself, the
> size or
> > > the ext2fs itself
> > > causing the problem.
> > >
> > > Does anybody see similar problems or do have an tip to investigate
> without
> > > risking my box'
> > > health switching it on/off on failure?
> > >
> >
> > I've not seen this on the smaller tests I've been able to run.
> >
> > So can you share the error messages that you get when you say you get I/O
> > errors? I'd like to see if this is due to an error in ext2fs or on the
> USB
> > drive. It's kinda sounding a little like the particular USB is triggering
> > some kind of issue that at the very least we should work around. Given
> that
> > it's not happening on all ext2fs drives you try to access, I'm leaning
> > towards the drive, but you never know.
> >
> > Thanks
>
> Plugging the USB flash gives the following hardware information on the
> console:
>
> [...]
> ugen1.5: <ASolid USB> at usbus1
> umass0 on uhub6
> umass0: <ASolid USB, class 0/0, rev 3.20/1.10, addr 4> on usbus1
> (probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10
> 00 00
> (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
> (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
> (probe0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid
> command
> operation code) (probe0:umass-sim0:0:0:0): Error 22, Unretryable error
> da4 at umass-sim0 bus 0 scbus11 target 0 lun 0
> da4: <ASolid USB > Removable Direct Access SPC-4 SCSI device
> da4: Serial Number somer serial numbers
> da4: 400.000MB/s transfers
> da4: 475000MB (972800000 512 byte sectors)
> da4: quirks=0x2<NO_6_BYTE>
> [...]
>
> Trying to mount via:  # mount -t ext2fs /dev/da4p1 /mnt/image
>
> [...]
> (da4:umass-sim0:0:0:0): got CAM status 0x444
> (da4:umass-sim0:0:0:0): fatal error, failed to attach to device
> da4 at umass-sim0 bus 0 scbus11 target 0 lun 0
> da4: <ASolid USB >  s/n some serial numbers  detached
> (da4:umass-sim0:0:0:0): Periph destroyed
>
> mount: /dev/da4p1: Device not configured
>

This has the classic hallmarks of a drive that loses its mind on
SYNCHRONIZE CACHE. Normally, we detect that automatically, but sometimes we
don't. Let's see if this drive is suffering from that. These instructions
are a bit long, but the shorter ones are harder to explain :).

First, you'll need to find what this drive is. You'll need to use
"usbconfig -v" to find the drive. Redirect that to a file, then search, you
should find something akin to

ugen0.13: <Flash Drive Silicon Motion, Inc. - Taiwan (formerly Feiya
Technology Corp.)> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON
(76mA)
ugen0.13.0: umass1: <ASolid USB, class 0/0, rev 3.00/11.00, addr 12>

The first line might not match, and the numbers will be different. But
you'll need the vendor and product IDs from this drive. They are a few
lines later and look akin to the following:
...
  idVendor = 0x090c
  idProduct = 0x1000
...

Now, remove the drive and type in the following (with your vendor and
product replacing mine):

usbconfig add_dev_quirk_vplh 0x090c 0x1000 0x0000
0xffff UQ_MSC_NO_SYNC_CACHE

This will add a quirk to the usb quirk table. You should see NO_SYNC_CACHE
show up in the da4 probe quirk report when you plug the drive back in.

If that fixes it, please let me know. "Hang on close" or "Periph goes away
on close" very often is due to this. umount will close the device. I may
have additional questions for you to help me add a quirk or a heuristic to
the code... I'm not yet sure, though, of the correlation to big files. It
may be something else, or it may be this.

Warner

[...]
>
> [...]
> # /compat/linux/sbin/fsck.ext4 /dev/da4p1
> e2fsck 1.46.5 (30-Dec-2021)
> SINA was not cleanly unmounted, check forced.
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> Error writing file system info: Invalid argument
>
> XXXX: ***** FILE SYSTEM WAS MODIFIED *****
>
> [...]
>
> detaching and attaching to another USB slot on the same (external) HUB:
>
> [...]
> ugen1.5: <ASolid USB> at usbus1
> umass0 on uhub6
> umass0: <ASolid USB, class 0/0, rev 3.20/1.10, addr 6> on usbus1
> (probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10
> 00 00
> (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
> (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
> (probe0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid
> command
> operation code) (probe0:umass-sim0:0:0:0): Error 22, Unretryable error
> da4 at umass-sim0 bus 0 scbus11 target 0 lun 0
> da4: <ASolid USB > Removable Direct Access SPC-4 SCSI device
> da4: Serial Number some serial numbers
> da4: 400.000MB/s transfers
> da4: 475000MB (972800000 512 byte sectors)
> da4: quirks=0x2<NO_6_BYTE>
> linux: jid 0 pid 5087 (fsck.ext4): linux_ioctl_fallback fd=3, cmd=0x127c
> ('\^R',124) is
> not implemented linux: jid 0 pid 5087 (fsck.ext4): linux_ioctl_fallback
> fd=3, cmd=0x125e
> ('\^R',94) is not implemented (da4:umass-sim0:0:0:0): got CAM status 0x444
> (da4:umass-sim0:0:0:0): fatal error, failed to attach to device
> da4 at umass-sim0 bus 0 scbus11 target 0 lun 0
> da4: <ASolid USB >  s/n some serial numbers detached
> (da4:umass-sim0:0:0:0): Periph destroyed
>
> [...]
>
> I can not even mount the device on CURRENT (FreeBSD 16.0-CURRENT #1
> master-n282217-34d66b0c96d5: Fri Nov 28 05:15:56 CET 2025 amd64).
>
> Package used for linux operation: emulators/linux-rl9
>

Reply via email to