From nobody Sat Nov 29 08:59:04 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 4dJPH23nfKz6JqPt for ; Sat, 29 Nov 2025 08:59:10 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp6.goneo.de (smtp6.goneo.de [85.220.129.31]) (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 4dJPH13MKLz3vKr for ; Sat, 29 Nov 2025 08:59:09 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=walstatt-de.de header.s=DKIM001 header.b=VlJ93hO2; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@walstatt-de.de designates 85.220.129.31 as permitted sender) smtp.mailfrom=freebsd@walstatt-de.de Received: from hub2.goneo.de (hub2.goneo.de [85.220.129.53]) (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 smtp6.goneo.de (Postfix) with ESMTPS id 89FF8240440; Sat, 29 Nov 2025 09:59:07 +0100 (CET) Received: from hub2.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 hub2.goneo.de (Postfix) with ESMTPS id CAF0024003C; Sat, 29 Nov 2025 09:59:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1764406745; 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=uALXwXcBwacrIoej8aNktcpr7ptsGHvhyNsVi38+/r4=; b=VlJ93hO2LVczU7QYumk0QNPLz4bqYiwuXsCwqYxCizKwWFbyUdxK3H/W3zu/0kGGkIthOI rpgwSeRYHhYQaFksYrzP94LRh2zpDn5t1LgAr30QI3mZM9T/AmLXizHFpmjrRWCeyss1SY VOmbaCLxf9oKCYvNePgdPOQlhQm5sQnYuOnjfs1DXbb4kQZf/dPIMz0QEwR7HPTR5yrh0p JNrCVuFH/3hFREPFOltwpCu0NMqVxEJjKMEZff9IvEllJO0mUnmBIAeOZVUBJhMdnifKsL wS88p/AcLyag+eMPK+rngRvOgFg2WYdfSbhIOY7rMaThMagzzYip6lwyWO19Ug== Received: from hermann (dynamic-2a02-3100-23f0-d502-fef0-00c8-2d71-c39d.310.pool.telefonica.de [IPv6:2a02:3100:23f0:d502:fef0:c8:2d71:c39d]) (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 hub2.goneo.de (Postfix) with ESMTPSA id 8B5CB24002F; Sat, 29 Nov 2025 09:59:05 +0100 (CET) Date: Sat, 29 Nov 2025 09:59:04 +0100 From: FreeBSD User To: Warner Losh Cc: FreeBSD CURRENT Subject: Re: freezing on unmountin ext2fs USB device Message-ID: <20251129095452.5905b7d5@hermann> In-Reply-To: References: <20251123151439.361dd84c@thor.sb211.local> <20251128062140.120e8369@hermann> 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/mixed; boundary="MP_/g7AqgxE.jh0RojGUA2zdZjg" X-Rspamd-UID: 75b4f1 X-Rspamd-UID: 596ade X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.10 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; MID_RHS_NOT_FQDN(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:85.220.129.0/25]; R_DKIM_ALLOW(-0.20)[walstatt-de.de:s=DKIM001]; RCVD_IN_DNSWL_LOW(-0.10)[85.220.129.31:from]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:25394, ipnet:85.220.128.0/17, country:DE]; MIME_TRACE(0.00)[0:+,1:+,2:+]; DMARC_NA(0.00)[walstatt-de.de]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[walstatt-de.de:+]; TO_DN_ALL(0.00)[]; HAS_ATTACHMENT(0.00)[] X-Rspamd-Queue-Id: 4dJPH13MKLz3vKr --MP_/g7AqgxE.jh0RojGUA2zdZjg Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thu, 27 Nov 2025 23:33:50 -0700 Warner Losh wrote: > On Thu, Nov 27, 2025, 10:22=E2=80=AFPM FreeBSD User wrote: >=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 > > > wrote: > > > =20 > > > > Hello, > > > > > > > > running FreeBSD 16.0-CURRENT #4 master-n282101-c8cf5a99f82b: Sun No= v 23 > > > > 13:56:23 CET > > > > 2025 amd64 I'm running into a serious problem when mounting an ext2= fs > > > > formated USB Flash > > > > device (512GB). The devince contains files written by a Linux syste= m, > > > > mounting the USB Flash > > > > via extended4fs, the size of the written datafiles is > 128GB. Dele= ting > > > > 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 =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, = ZFS =20 > > - =20 > > > > no problem, another > > > > 128GB, UFS, no problem and several much smaller (4 - 64GB) with FAT= or =20 > > UFS =20 > > > > filesystems, all no > > > > problem. > > > > > > > > I can not figure out whether it is the USB flash drive itself, the = =20 > > size or =20 > > > > the ext2fs itself > > > > causing the problem. > > > > > > > > Does anybody see similar problems or do have an tip to 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 get= I/O > > > errors? I'd like to see if this is due to an error in ext2fs or on th= e =20 > > USB =20 > > > drive. It's kinda sounding a little like the particular USB is trigge= ring > > > some kind of issue that at the very least we should work around. Give= n =20 > > that =20 > > > it's not happening on all ext2fs drives you try to access, I'm leaning > > > 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 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 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 >=20 > 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 :). >=20 > 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, y= ou > should find something akin to >=20 > ugen0.13: Technology Corp.)> at usbus0, cfg=3D0 md=3DHOST spd=3DSUPER (5.0Gbps) pwr= =3DON > (76mA) > ugen0.13.0: umass1: >=20 > 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 > ... 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): >=20 > usbconfig add_dev_quirk_vplh 0x090c 0x1000 0x0000 > 0xffff UQ_MSC_NO_SYNC_CACHE In my case in question it would be usbconfig add_dev_quirk_vplh 0x24a9 0x205a 0x0000 0xffff UQ_MSC_NO_SYNC_CAC= HE right? >=20 > 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. >=20 > 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. 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=20 (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: 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=20 (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: 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=20 [...] Trying to mount /dev/da4p1 (which is the supposed ext4fs/ext2fs partition o= n 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 ope= n /dev/da4p1 Possibly non-existent device? and on console (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 lost = its head also. Regards, Oliver p.s. One note:=20 # gpart show -l da4 =3D> 40 972799920 da4 GPT (464G) 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 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 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=3D0= x127c > > ('\^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 0x= 444 > > (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 --MP_/g7AqgxE.jh0RojGUA2zdZjg Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=usb_asolid.txt ugen1.5: at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (76mA) ugen1.5.0: umass0: bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0320 bDeviceClass = 0x0000 bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0009 idVendor = 0x24a9 idProduct = 0x205a bcdDevice = 0x0110 iManufacturer = 0x0002 iProduct = 0x0003 iSerialNumber = 0x0004 bNumConfigurations = 0x0001 Configuration index 0 bLength = 0x0009 bDescriptorType = 0x0002 wTotalLength = 0x002c bNumInterfaces = 0x0001 bConfigurationValue = 0x0001 iConfiguration = 0x0000 bmAttributes = 0x0080 bMaxPower = 0x0026 Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0000 bNumEndpoints = 0x0002 bInterfaceClass = 0x0008 bInterfaceSubClass = 0x0006 bInterfaceProtocol = 0x0050 iInterface = 0x0000 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 bmAttributes = 0x0002 wMaxPacketSize = 0x0400 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Additional Descriptor bLength = 0x06 bDescriptorType = 0x30 bDescriptorSubType = 0x03 RAW dump: 0x00 | 0x06, 0x30, 0x03, 0x00, 0x00, 0x00 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0002 bmAttributes = 0x0002 wMaxPacketSize = 0x0400 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Additional Descriptor bLength = 0x06 bDescriptorType = 0x30 bDescriptorSubType = 0x03 RAW dump: 0x00 | 0x06, 0x30, 0x03, 0x00, 0x00, 0x00 --MP_/g7AqgxE.jh0RojGUA2zdZjg--