Subject: kern/29250: Failure to umount umass device (Topcom Pocket MP3 III)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <dieter.NetBSD@pandora.be>
List: netbsd-bugs
Date: 02/06/2005 14:55:00
>Number:         29250
>Category:       kern
>Synopsis:       Failure to umount umass device (Topcom Pocket MP3 III)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 06 14:55:00 +0000 2005
>Originator:     Dieter Roelants
>Release:        NetBSD 2.99.15, NetBSD 2.0.1
>Organization:
>Environment:
NetBSD okuma.amelgem.be 2.99.15 NetBSD 2.99.15 (OKUMA) #20: Fri Jan 28 23:43:50 CET 2005  dieter@okuma.amelgem.be:/usr/build/netbsd-current/obj/sys/arch/i386/compile/OKUMA i386
NetBSD orange.amelgem.be 2.99.15 NetBSD 2.99.15 (GENERIC) #1: Sat Jan 29 23:50:05 CET 2005  dieter@okuma.amelgem.be:/usr/build/netbsd-current/obj/sys/arch/macppc/compile/GENERIC macppc
NetBSD inflamm.able.be 2.0.1 NetBSD 2.0.1 (INFLAMM.MP) #10: Mon Jan 17 15:46:24 CET 2005  dieter@inflamm.able.be:/usr/build/obj/sys/arch/i386/compile/INFLAMM.MP i386
>Description:
	When attaching and mounting this device:

umass0 at uhub0 port 2 configuration 1 interface 0
umass0: AccFast MP3 Player, rev 1.10/2.05, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 2 luns per target
sd0 at scsibus0 target 0 lun 0: <AccFast, USB-MSC Disk IN, T> disk removable
sd0: fabricating a geometry
sd0: 239 MB, 239 cyl, 64 head, 32 sec, 512 bytes/sect x 490496 sectors
sd1 at scsibus0 target 0 lun 1: <AccFast, USB-MSC Disk EX, T> disk removable
sd1: drive offline

	umount hangs forever if anything was written to the device.
	(This happens on both drives, sd0 is builtin flash, sd1 is
	an mmc device). This happens with uhci as well as with
	ohci. While umount is hanging, mount show the device as
	being unmounted but detaching it makes 2.0.1 freeze (known
	problem), in -current it gives:

umass0: at uhub0 port 1umass0: BBB bulk-out stall clear failed, IOERROR
 (addr 5) disconnected
umass0: BBB reset failed, IOERROR
sd0(umass0:0:0:0): generic HBA error
sd0: cache synchronization failed
sd0(umass0:0:0:0): generic HBA error
sd0(umass0:0:0:0): generic HBA error
sd0 detached
sd1 detached
scsibus1 detached
umass0 detached

	Because I don't really know what to look for, I have
	performed these steps with different levels of debugging:

	Without debugging:
	==================

	- attach
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/00-attach
	- detach
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/01-detach


	With umassdebug=0xffffff:
	=========================

	- attach
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/09-attach
	- mount
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/10-mount
	- umount
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/11-umount
	- detach
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/12-detach
	- touching a file
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/06-touch
	- umount after touching
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/07-umount
	- detach after/while failed umount
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/08-detach


	With umassdebug=0xffffff and uhcidebug=0x20:
	============================================

	- attach
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/13-attach
	- mount
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/14-mount
	- umount
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/15-umount
	- detach
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/16-detach
	- touching a file
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/19-touch
	- umount after touching
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/20-umount
	- detach after/while failed umount
	http://r2d2.rave.org/~dieter/NetBSD/USB-Topcom-Pocket-MP3-III/21-detach


>How-To-Repeat:
	Insert and mount Topcom Pocket MP3 III or similar device,
	write something to it, then try to unmount.
>Fix: