From nobody Sat Nov 29 18:37:21 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 4dJf750Bvpz6HhpF for ; Sat, 29 Nov 2025 18:38:09 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp052.goneo.de (smtp5.goneo.de [IPv6:2001:1640:5::8:30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4dJf744Tq5z3Dq7 for ; Sat, 29 Nov 2025 18:38:08 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; none Received: from hub1.goneo.de (hub1.goneo.de [85.220.129.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp5.goneo.de (Postfix) with ESMTPS id 684DB24078B; Sat, 29 Nov 2025 19:37:57 +0100 (CET) Received: from hub1.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub1.goneo.de (Postfix) with ESMTPS id CC20724074D; Sat, 29 Nov 2025 19:37:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1764441475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YJEWcC7mM2fsCJPANMR6+f7qU6Le8QKM16wP4fbNc5s=; b=oiw4FstQHTDRSTpGWcvK8n0bs3Z2bImBmMja5kRU/ekfQiBMFKyrmNblAQDuETahEJApiA Y7PMLd/WEWbZn7fCoBVZ4DhxW/V1nUwftLoBaMkFbvPLkdC0wp3I12A5MgNwGrJhOVYW4M 4k5YhxF8rOssXDe/Dm9QMPNj71JedFLtJ+fXUuSxqoBuz29U6/gNSlHVuhpmee8wcdxD0O FW/JJNGz2GKtZMhoNv5OhqXhU5GsPXnoSyvLwi9VY0OQIQ1YeDCxp7hFsXAIozxBaL4YYi tkuzeXDJl9OiRTo87+wfNp133bP5Vnnl8YqbJ4agexVcuXAeRGqrfJtyLw1NgQ== Received: from thor.sb211.local (dynamic-2a02-3100-23f0-d502-021b-21ff-fe4e-8f4d.310.pool.telefonica.de [IPv6:2a02:3100:23f0:d502:21b:21ff:fe4e:8f4d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub1.goneo.de (Postfix) with ESMTPSA id 7E2C8240459; Sat, 29 Nov 2025 19:37:55 +0100 (CET) Date: Sat, 29 Nov 2025 19:37:21 +0100 From: A FreeBSD User To: Warner Losh Cc: FreeBSD CURRENT Subject: Re: freezing on unmountin ext2fs USB device Message-ID: <20251129193738.29f4a1f3@thor.sb211.local> In-Reply-To: References: <20251123151439.361dd84c@thor.sb211.local> <20251128062140.120e8369@hermann> <20251129095452.5905b7d5@hermann> X-Mailer: Claws Mail 3.21.0 (GTK+ 2.24.33; amd64-portbld-freebsd16.0) 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 Content-Type: multipart/signed; boundary="Sig_/CZs8u8qKZNUFV84ak0RVn5."; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Rspamd-UID: 66a98f X-Rspamd-UID: d3faae 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: 4dJf744Tq5z3Dq7 --Sig_/CZs8u8qKZNUFV84ak0RVn5. Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Tage des Herren Sat, 29 Nov 2025 03:32:09 -0700 Warner Losh schrieb: > On Sat, Nov 29, 2025 at 1:59=E2=80=AFAM FreeBSD User wrote: >=20 > > On Thu, 27 Nov 2025 23:33:50 -0700 > > Warner Losh wrote: > > =20 > > > On Thu, Nov 27, 2025, 10:22=E2=80=AFPM FreeBSD User =20 > > wrote: =20 > > > =20 > > > > On Tue, 25 Nov 2025 21:03:01 -0700 > > > > Warner Losh wrote: > > > > =20 > > > > > On Sun, Nov 23, 2025 at 7:15=E2=80=AFAM A FreeBSD User < =20 > > freebsd@walstatt-de.de> =20 > > > > > wrote: > > > > > =20 > > > > > > Hello, > > > > > > > > > > > > running FreeBSD 16.0-CURRENT #4 master-n282101-c8cf5a99f82b: Su= n =20 > > Nov 23 =20 > > > > > > 13:56:23 CET > > > > > > 2025 amd64 I'm running into a serious problem when mounting an = =20 > > ext2fs =20 > > > > > > formated USB Flash > > > > > > device (512GB). The devince contains files written by a Linux = =20 > > system, =20 > > > > > > mounting the USB Flash > > > > > > via extended4fs, the size of the written datafiles is > 128GB. = =20 > > Deleting =20 > > > > > > those files larger > > > > > > than some 20GB results in an I/O error reported by FReeBSD (# s= udo =20 > > rm =20 > > > > > > /mnt/USB/filename). > > > > > > Unmounting the ext2fs after deletion (sudo umount /mnt) results= in =20 > > a =20 > > > > total =20 > > > > > > 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, =20 > > ZFS =20 > > > > - =20 > > > > > > no problem, another > > > > > > 128GB, UFS, no problem and several much smaller (4 - 64GB) with= =20 > > FAT or =20 > > > > UFS =20 > > > > > > filesystems, all no > > > > > > problem. > > > > > > > > > > > > I can not figure out whether it is the USB flash drive itself, = =20 > > the =20 > > > > size or =20 > > > > > > the ext2fs itself > > > > > > causing the problem. > > > > > > > > > > > > Does anybody see similar problems or do have an tip to =20 > > investigate =20 > > > > without =20 > > > > > > risking my box' > > > > > > health switching it on/off on failure? > > > > > > =20 > > > > > > > > > > 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= =20 > > get I/O =20 > > > > > errors? I'd like to see if this is due to an error in ext2fs or o= n =20 > > the =20 > > > > USB =20 > > > > > drive. It's kinda sounding a little like the particular USB is =20 > > triggering =20 > > > > > some kind of issue that at the very least we should work around. = =20 > > Given =20 > > > > that =20 > > > > > it's not happening on all ext2fs drives you try to access, I'm =20 > > leaning =20 > > > > > towards the drive, but you never know. > > > > > > > > > > Thanks =20 > > > > > > > > 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 0= 0 =20 > > 00 10 =20 > > > > 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 =20 > > (Invalid =20 > > > > command > > > > operation code) (probe0:umass-sim0:0:0:0): Error 22, Unretryable er= ror > > > > 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 > > > > =20 > > > > > > This has the classic hallmarks of a drive that loses its mind on > > > SYNCHRONIZE CACHE. Normally, we detect that automatically, but someti= mes =20 > > we =20 > > > don't. Let's see if this drive is suffering from that. These instruct= ions > > > 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 searc= h, =20 > > you =20 > > > should find something akin to > > > > > > ugen0.13: > > Technology Corp.)> 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 > > > ... =20 > > > > You'll find the required output as attachment, desinated usb_asolid.txt. > > > > The required identifications should be > > > > idVendor =3D 0x24a9 > > idProduct =3D 0x205a > > bcdDevice =3D 0x0110 > > > > =20 > > > > > > 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 =20 > > > > In my case in question it would be > > > > usbconfig add_dev_quirk_vplh 0x24a9 0x205a 0x0000 0xffff > > UQ_MSC_NO_SYNC_CACHE > > > > right? > > =20 > > > > > > This will add a quirk to the usb quirk table. You should see =20 > > NO_SYNC_CACHE =20 > > > 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= =20 > > away =20 > > > 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 heurist= ic =20 > > to =20 > > > the code... I'm not yet sure, though, of the correlation to big files= . It > > > may be something else, or it may be this. =20 > > > > Do not see required state change in output: > > > > [...] > > 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= 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 > > =20 >=20 > I would have expected a quirk line for umass0: >=20 > [911991.296485] umass1 numa-domain 0 on uhub13 > [911991.299036] umass1: addr 12> on usbus0 > [911991.305703] umass1: SCSI over Bulk-Only; quirks =3D > 0x4000 >=20 > Is what I get. I don't see the SCSI over Bulk-Only line either in your > demsg. I wonder why. >=20 My crap device is at 1.5: ugen1.5: at usbus1, cfg=3D0 md=3DHOST spd=3DHIGH (480Mbps) pwr= =3DON (200mA) > I think your device is at 0.6, so something like the following (confirm > with usbconfig showing ugen0.4 as this device): >=20 > usbconfig -d ugen0.6 power_off > usbconfig -d ugne0.6 add_quirk UQ_MSC_NO_SYNC_CACHE > usbconfig -d ugen0.6 power_on #: sudo usbconfig -d ugen1.5 power_off #: sudo usbconfig -d ugen1.5 add_quirk UQ_MSC_NO_SYNC_CACHE #: sudo usbconfig -d ugen1.5 power_on which gives me: # dmesg ugen1.5: at usbus1 umass0 on uhub9 umass0: on usbus1 da4 at umass-sim0 bus 0 scbus11 target 0 lun 0 da4: Removable Direct Access SPC-2 SCSI device da4: Serial Number 25010993010046 da4: 40.000MB/s transfers da4: 475000MB (972800000 512 byte sectors) da4: quirks=3D0x2 umass0: at uhub9, port 2, addr 4 (disconnected) da4 at umass-sim0 bus 0 scbus11 target 0 lun 0 da4: s/n 25010993010046 detached (da4:umass-sim0:0:0:0): Periph destroyed umass0: detached umass0 on uhub9 umass0: on usbus1 da4 at umass-sim0 bus 0 scbus11 target 0 lun 0 da4: Removable Direct Access SPC-2 SCSI device da4: Serial Number 25010993010046 da4: 40.000MB/s transfers da4: 475000MB (972800000 512 byte sectors) da4: quirks=3D0x2 And with a 256GB expensive SAMSUNG USB Flash: ugen1.5: at usbus1 umass0 on uhub6 umass0: on usbus1 da4 at umass-sim0 bus 0 scbus11 target 0 lun 0 da4: Removable Direct Access SPC-4 SCSI device da4: Serial Number 0373220010001862 da4: 400.000MB/s transfers da4: 244752MB (501253132 512 byte sectors) da4: quirks=3D0x2 doing the simialr thing as you did: sudo usbconfig -d ugen1.5 power_off sudo usbconfig -d ugen1.5 add_quirk UQ_MSC_NO_SYNC_CACHE sudo usbconfig -d ugen1.5 power_on gives: (da4:umass-sim0:0:0:0): Periph destroyed umass0: detached umass0 on uhub6 umass0: on usbus1 da4 at umass-sim0 bus 0 scbus11 target 0 lun 0 da4: Removable Direct Access SPC-4 SCSI device da4: Serial Number 0373220010001862 da4: 400.000MB/s transfers da4: 244752MB (501253132 512 byte sectors) da4: quirks=3D0x2 REMARK: I use a USB HUB, powered, might that induce some spooky actions? My= housing does have outdated USB 2 connectors on the front, it is hard for me to crawl undernea= th the (dusty) desk behind the housing and search for a free USB 3 port ... >=20 > is what I did to generate the umass line above (but with 0.13 instead of > 0.6). I wish there was a quirk for REPORT LUNS not being supported, but > that warning is harmless. We'll ignore the error and go on to the next > thing (I should fix the errors we're just going to ignore when they aren't > supported, but I digress). If you can build a kernel, adding USB_DEBUG to > it for the duration of testing would give us more information, including > the line that I have and that you don't (maybe I should make that > unconditional). >=20 >=20 > > da4 at umass-sim0 bus 0 scbus11 target 0 lun 0 > > da4: Removable Direct Access SPC-4 SCSI device > > da4: Serial Number 25010993010046 > > da4: 400.000MB/s transfers > > da4: 475000MB (972800000 512 byte sectors) > > da4: quirks=3D0x2 > > ugen1.5: at usbus1 (disconnected) > > umass0: at uhub6, port 1, addr 4 (disconnected) > > da4 at umass-sim0 bus 0 scbus11 target 0 lun 0 > > da4: s/n 25010993010046 detached > > (da4:umass-sim0:0:0:0): Periph destroyed > > umass0: detached > > 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= 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: Removable Direct Access SPC-4 SCSI device > > da4: Serial Number 25010993010046 > > da4: 400.000MB/s transfers > > da4: 475000MB (972800000 512 byte sectors) > > da4: quirks=3D0x2Tryping to mount > > > > [...] > > > > Trying to mount /dev/da4p1 (which is the supposed ext4fs/ext2fs partiti= on > > on the USB > > flash device) results in: > > > > WARNING: R/W mount denied. Filesystem is not clean - run fsck > > > > and when trying to solve the problem via > > > > [...] > > # /compat/linux/sbin/fsck.ext4 /dev/da4p1 > > e2fsck 1.46.5 (30-Dec-2021) > > /compat/linux/sbin/fsck.ext4: No such file or directory while trying to > > open /dev/da4p1 > > Possibly non-existent device? > > > > and on console > > =20 >=20 > the following are the only new one? maybe I missed one line with "umass0: detached", see above, the new lines I= posted, there is one more line ... >=20 >=20 > > (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 25010993010046 detached > > (da4:umass-sim0:0:0:0): Periph destroyed > > > > > > I think this special "low cost" device did not only lost its mind, it l= ost > > its head > > also. > > =20 >=20 > Yes. I kinda want to swap you for this: you send it to me and I'll send y= ou > one of my happy devices :) >=20 > Warner I would do that, if I could, but I would raise a "state incident" ;-) I might have another one, still wrapped in. But with reference to my SAMSUN= G Flash drive, see above, and not willing disabling SYNCACHE, isn't it more likely to be some = issue with my setup/hardware? >=20 >=20 > > Regards, > > > > Oliver > > > > p.s. One note: > > > > # gpart show -l da4 =20 > > =3D> 40 972799920 da4 GPT (464G) =20 > > 40 972799920 1 (null) (464G) > > > > The device in question does have a GPT partition layout. I guess it > > doesn't matter here, > > but I'll add it anyway for the record. > > =20 > > > > > > Warner > > > > > > [...] =20 > > > > > > > > [...] > > > > # /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 0= 0 =20 > > 00 10 =20 > > > > 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 =20 > > (Invalid =20 > > > > command > > > > operation code) (probe0:umass-sim0:0:0:0): Error 22, Unretryable er= ror > > > > 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, =20 > > cmd=3D0x127c =20 > > > > ('\^R',124) is > > > > not implemented linux: jid 0 pid 5087 (fsck.ext4): linux_ioctl_fall= back > > > > fd=3D3, cmd=3D0x125e > > > > ('\^R',94) is not implemented (da4:umass-sim0:0:0:0): got CAM statu= s =20 > > 0x444 =20 > > > > (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 > > > > =20 > > > > =20 --=20 A FreeBSD user --Sig_/CZs8u8qKZNUFV84ak0RVn5. Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRQheDybVktG5eW/1Kxzvs8OqokrwUCaSs9fAAKCRCxzvs8Oqok r3I+AP4gsJXsaZ143mig3z7dfEevxIsojAHe6t7SK87bxD8h+AD/aNJvnf1k8Nrd GKEAtSxhZAeXtYoYOSejtTQ9l7kICAY= =nYHv -----END PGP SIGNATURE----- --Sig_/CZs8u8qKZNUFV84ak0RVn5.--