From nobody Fri Nov 28 06:33:50 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dHk682DTvz6JCCq for ; Fri, 28 Nov 2025 06:34:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dHk676DF0z3jXj for ; Fri, 28 Nov 2025 06:34:07 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-29568d93e87so15093035ad.2 for ; Thu, 27 Nov 2025 22:34:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1764311641; x=1764916441; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5u4sbO/WRQkX7KL0AbBZYAW+UxwMITNFRJ4TTWTUEBg=; b=KGMQwg5P2m1kKbU3gOmijEilukzp/4GI6lCQGvV168i3HxqYOVcBaA/xGxA7QHPb/o a2gMaGqXkwLN9XWu2c4uymoh3xyQOODSxORIqA5xAvJc6WdVZdpkR7DePavTh1MF+V2s VOHclqFijvNQQK7qc4feoug8yLF/bNFjb4QIK+Bq38toi/W0fTFZjgJz+kpdPwPu0PrF GQjMMgkL1VjYy0Eje0ANIFn17ND0cnINdfvEXjd69S2SrwT9pZR66TzrEBDwwxInAKjs DyZhwLLLl4fEmVPjxNZL4nLdfS8xNJe0laPy677r14y02Fztc0wOj526S1vve6W5I3zU 4lRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764311641; x=1764916441; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5u4sbO/WRQkX7KL0AbBZYAW+UxwMITNFRJ4TTWTUEBg=; b=HU2YWjQVCXhApmzLHDrtOPxaNyFskKZ1Qn3XoRG1CC/AzZiMH11q7RIV85BgxYKqNT 68IaycC3t5b4gDzxGozdF86yobKzrtM7H7m85w/sMNlO6hYedtxohX52aXBwECcH4b8H 8Aup0DZzBgmb1AgzI93hYvsGaRUYkVBKc89YgpOA9tngB9RRa1RlR90cmUsSBuXqW+/+ hwsMK+rediEcmTBYbv2Yjac7aZwVwDiD4s86Mry1IlWsalGtfcE2JqT3LSlnlrdofKZt WMY+aW5ZZsqt0kIvrubLbxw4cFkOIy8IFCXrgP2iTkJSmhjinLLPE7X52daXKdJYZHAc utQA== X-Gm-Message-State: AOJu0YzH1nmoUwZjY7tt3YOrlr+s/yVaPfgzglw53s9kB+9rBLD9uz8N kLCAfNJfunoYEZmv5CaEnEcmlATXN0bQuSGdsevWh020IOMKIAOB8th7OITLSfKpEjAwsiouQ12 2SRhU8nfExmkr4ehxnrBLkLCHInbygqmAOFEjKM7Mq/xdDLN9H2qw6AfDog== X-Gm-Gg: ASbGncuBY7rSliGNs9ANP3Y+gH4JX5hwazxikW3PhUYjNFu0SUpU3usxRypHFTM7a5D 7E4HqbOpFzzxUCl06fcyaS8E0QY6BT7KTP4T5kXiJ8T1BXJ2G4nuYImJTIjJL1kNhua8Glocy2X FndWKuPGysqRRpMhUzExB9kOxmdf8hSvpv+ftCQE1P58lf2Wf7FveqJ2T1Sscv6LBUzPq39WsGl SfZJcIrjursrPEoRjatbqFuKbLvKqde76yIBrc40xhHkMo3fThC/RqnJBB4Ptayg01Q0xE= X-Google-Smtp-Source: AGHT+IHTPjJsUGVSJs2gOU0p0zIb+2GU6ycv2FT4tLrChosY/nBSGhHJ2A2ketbivhc5s0U/GFPwydJ1ep7wS75c5+I= X-Received: by 2002:a17:902:d4d1:b0:246:e1b6:f9b0 with SMTP id d9443c01a7336-29baaf9abb7mr152896225ad.18.1764311641382; Thu, 27 Nov 2025 22:34:01 -0800 (PST) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 References: <20251123151439.361dd84c@thor.sb211.local> <20251128062140.120e8369@hermann> In-Reply-To: <20251128062140.120e8369@hermann> From: Warner Losh Date: Thu, 27 Nov 2025 23:33:50 -0700 X-Gm-Features: AWmQ_bnfroXG4CZC8HFQj9AjrEROQnyAcUHWjjhK6JE3ufs966ap9kA3ldGd780 Message-ID: Subject: Re: freezing on unmountin ext2fs USB device To: FreeBSD User Cc: FreeBSD CURRENT Content-Type: multipart/alternative; boundary="000000000000a86d030644a1d052" X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dHk676DF0z3jXj --000000000000a86d030644a1d052 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Nov 27, 2025, 10:22=E2=80=AFPM FreeBSD User wrote: > On Tue, 25 Nov 2025 21:03:01 -0700 > Warner Losh wrote: > > > On Sun, Nov 23, 2025 at 7:15=E2=80=AFAM A FreeBSD User > > 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. Deleti= ng > > > 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, ZF= S > - > > > no problem, another > > > 128GB, UFS, no problem and several much smaller (4 - 64GB) with FAT o= r > 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 triggeri= ng > > 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: at usbus1 > umass0 on uhub6 > umass0: on usbus1 > (probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 1= 0 > 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: 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=3D0x2 > [...] > > 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: 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: at usbus0, cfg=3D0 md=3DHOST spd=3DSUPER (5.0Gbps) pwr= =3DON (76mA) ugen0.13.0: umass1: 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 =3D 0x090c idProduct =3D 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: at usbus1 > umass0 on uhub6 > umass0: on usbus1 > (probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 1= 0 > 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: 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=3D0x2 > linux: jid 0 pid 5087 (fsck.ext4): linux_ioctl_fallback fd=3D3, cmd=3D0x1= 27c > ('\^R',124) is > not implemented linux: jid 0 pid 5087 (fsck.ext4): linux_ioctl_fallback > fd=3D3, cmd=3D0x125e > ('\^R',94) is not implemented (da4:umass-sim0:0:0:0): got CAM status 0x44= 4 > (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: 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 > --000000000000a86d030644a1d052 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Nov 27, 2025, 10:22=E2=80=AFP= M FreeBSD User <freebsd@walstatt-de.de> wrote:
On Tue, 25 Nov 2025 21:03:01 -0700
Warner Losh <imp@bsdimp.com> wrote:

> On Sun, Nov 23, 2025 at 7:15=E2=80=AFAM A FreeBSD User <freebsd= @walstatt-de.de>
> 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 a= n ext2fs
> > formated USB Flash
> > device (512GB). The devince contains files written by a Linux sys= tem,
> > 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 (# sud= o rm
> > /mnt/USB/filename).
> > Unmounting the ext2fs after deletion (sudo umount /mnt) results i= n a total
> > freeze of the box.
> > No crash, no core dump, nothing. I waited almost an hour hoping f= or
> > 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 F= AT or UFS
> > filesystems, all no
> > problem.
> >
> > I can not figure out whether it is the USB flash drive itself, th= e size or
> > the ext2fs itself
> > causing the problem.
> >
> > Does anybody see similar problems or do have an tip to investigat= e without
> > risking my box'
> > health switching it on/off on failure?
> >=C2=A0
>
> 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 tri= ggering
> 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 cons= ole:

[...]
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 co= mmand
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=3D0x2<NO_6_BYTE>
[...]

Trying to mount via:=C2=A0 # 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 >=C2=A0 s/n some serial numbers=C2=A0 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 a= utomatically, but sometimes we don't. Let's see if this drive is su= ffering from that. These instructions are a bit long, but the shorter ones = are harder to explain :).

First, you&= #39;ll need to find what this drive is. You'll need to use "usbcon= fig -v" to find the drive. Redirect that to a file, then search, you s= hould find something akin to

ugen0.13: <Flash D= rive Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.)> at= usbus0, cfg=3D0 md=3DHOST spd=3DSUPER (5.0Gbps) pwr=3DON (76mA)
ugen0.1= 3.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 f= rom this drive. They are a few lines later and look akin to the following:<= /div>
...
=C2=A0 idVendor =3D 0x090c
=C2=A0 idProduct =3D = 0x1000
...

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

usbconfig=C2=A0add_dev_quirk_= vplh 0x090c 0x1000 0x0000 0xffff=C2=A0UQ_MSC_NO_SYNC_CACHE

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

If that fixes it, please let me know. "H= ang on close" or "Periph goes away on close" very often is d= ue to this. umount will close the device. I may have additional questions f= or 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, o= r 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 co= mmand
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=3D0x2<NO_6_BYTE>
linux: jid 0 pid 5087 (fsck.ext4): linux_ioctl_fallback fd=3D3, cmd=3D0x127= c ('\^R',124) is
not implemented linux: jid 0 pid 5087 (fsck.ext4): linux_ioctl_fallback fd= =3D3, cmd=3D0x125e
('\^R',94) is not implemented (da4:umass-sim0:0:0:0): got CAM statu= s 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 >=C2=A0 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
--000000000000a86d030644a1d052--