Subject: kern/15098: 128MB DiskOnKey USB memory devices does not work because of missing quirk
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kivinen@ssh.fi>
List: netbsd-bugs
Date: 12/30/2001 19:28:26
>Number:         15098
>Category:       kern
>Synopsis:       128MB DiskOnKey USB memory devices does not work because of missing quirk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 30 09:31:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tero Kivinen
>Release:        NetBSD 1.5ZA
>Organization:
SSH Communications Security
>Environment:
System: NetBSD kaakeli.ssh.fi 1.5ZA NetBSD 1.5ZA (KAAKELI) #0: Fri Dec 28 19:37:49 EET 2001 kivinen@kaakeli.ssh.fi:/usr/src/sys/arch/i386/compile/KAAKELI i386
Architecture: i386
Machine: i386
>Description:

	128MB DiskOnKey uses different version number than the older
	DiskOnKey devices and this causes that the quirks in the
	scsiconf.c does not match.

	For some reason the device is also randomly detected using
	SCSI over BBB-P, and if that happens then it does not work at
	all. Unplugging the device, rebooting, and retrying might then
	properly detect SCSI over Bulk-Only, and then the device seems to
	work. For the first time it was using the BBB-P the machine
	actually paniced (uvm_fault) when the device was unplugged:

Dec 28 17:23:23 kaakeli /netbsd: umass0 at uhub0 port 1 configuration 1 interface 0
Dec 28 17:23:23 kaakeli /netbsd: 
Dec 28 17:23:23 kaakeli /netbsd: umass0: M-Systems DiskOnKey, rev 1.10/2.00, addr 2
Dec 28 17:23:23 kaakeli /netbsd: umass0: using SCSI over BBB-P
Dec 28 17:23:46 kaakeli sudo:  kivinen : TTY=ttyp3 ; PWD=/usr/lu/kivinen ; USER=root ; COMMAND=/p/bin/zsh
Dec 28 17:25:41 kaakeli syslogd: restart
Dec 28 17:25:42 kaakeli /netbsd: umass0: at uhub0 port 1 (addr 2) disconnected
Dec 28 17:25:42 kaakeli /netbsd: uvm_fault(0xc04cb6e0, 0x0, 0, 1) -> e
Dec 28 17:25:42 kaakeli last message repeated 4 times
Dec 28 17:25:42 kaakeli /netbsd: syncing disks... 1 done
...
Dec 28 17:27:01 kaakeli /netbsd: umass0 at uhub0 port 1 configuration 1 interface 0
Dec 28 17:27:01 kaakeli /netbsd: 
Dec 28 17:27:01 kaakeli /netbsd: umass0: M-Systems DiskOnKey, rev 1.10/2.00, addr 2
Dec 28 17:27:01 kaakeli /netbsd: umass0: using SCSI over BBB-P
Dec 28 17:27:01 kaakeli /netbsd: scsibus0 at umass0: 2 targets, 1 luns per target
Dec 28 17:27:01 kaakeli /netbsd: scsibus0: waiting 2 seconds for devices to settle...
Dec 28 17:27:03 kaakeli /netbsd: sd0 at scsibus0 target 1 lun 0: <M-Sys, DiskOnKey, 2.50> SCSI0 0/direct removable
Dec 28 17:27:03 kaakeli /netbsd: sd0: mode sense (4) returned nonsense; using fictitious geometry
Dec 28 17:27:03 kaakeli /netbsd: sd0: 125 MB, 125 cyl, 64 head, 32 sec, 512 bytes/sect x 256352 sectors
Dec 28 17:27:19 kaakeli sudo:  kivinen : TTY=ttyp0 ; PWD=/usr/lu/kivinen ; USER=root ; COMMAND=/p/bin/zsh
Dec 28 17:27:27 kaakeli /netbsd: sd0: mode sense (4) returned nonsense; using fictitious geometry
Dec 28 17:28:08 kaakeli sudo:  kivinen : TTY=ttyp2 ; PWD=/usr/lu/kivinen ; USER=root ; COMMAND=/p/bin/zsh
Dec 28 17:28:21 kaakeli syslogd: Exiting on signal 15

Dec 28 17:30:30 kaakeli syslogd: restart
Dec 28 17:30:30 kaakeli /netbsd: sd0: dos partition I/O error
Dec 28 17:30:30 kaakeli /netbsd: syncing disks... done
Dec 28 17:30:30 kaakeli /netbsd: rebooting...
...

Dec 28 17:30:32 kaakeli /netbsd: umass0 at uhub0 port 1 configuration 1 interface 0
Dec 28 17:30:32 kaakeli /netbsd: umass0: M-Systems DiskOnKey, rev 1.10/2.00, addr 2
Dec 28 17:30:32 kaakeli /netbsd: umass0: using SCSI over BBB-P
Dec 28 17:30:32 kaakeli /netbsd: scsibus0 at umass0: 2 targets, 1 luns per target
Dec 28 17:30:32 kaakeli /netbsd: scsibus0: waiting 2 seconds for devices to settle...
Dec 28 17:30:32 kaakeli /netbsd: sd0 at scsibus0 target 1 lun 0: <M-Sys, DiskOnKey, 2.50> SCSI0 0/direct removable
Dec 28 17:30:32 kaakeli /netbsd: sd0: mode sense (4) returned nonsense; using fictitious geometry
Dec 28 17:30:32 kaakeli /netbsd: sd0: 125 MB, 125 cyl, 64 head, 32 sec, 512 bytes/sect x 256352 sectors
Dec 28 17:30:32 kaakeli /netbsd: sd0: mode sense (4) returned nonsense; using fictitious geometry
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: sd0: dos partition I/O error
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB reset failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-in clear stall failed, IOERROR
Dec 28 17:30:32 kaakeli /netbsd: umass0: BBB bulk-out clear stall failed, IOERROR
Dec 28 17:30:33 kaakeli /netbsd: umass0: at uhub0 port 1 (addr 2) disconnected
Dec 28 17:30:33 kaakeli /netbsd: sd0 detached
Dec 28 17:30:33 kaakeli /netbsd: scsibus0 detached
Dec 28 17:30:33 kaakeli /netbsd: umass0 detached
Dec 28 17:30:33 kaakeli /netbsd: boot device: wd0
...
Dec 28 21:45:59 kaakeli /netbsd: umass0 at uhub0 port 1 configuration 1 interface 0
Dec 28 21:45:59 kaakeli /netbsd: 
Dec 28 21:45:59 kaakeli /netbsd: umass0: M-Systems DiskOnKey, rev 1.10/2.00, addr 2
Dec 28 21:45:59 kaakeli /netbsd: umass0: using SCSI over Bulk-Only
Dec 28 21:45:59 kaakeli /netbsd: scsibus0 at umass0: 2 targets, 1 luns per target
Dec 28 21:45:59 kaakeli /netbsd: scsibus0: waiting 2 seconds for devices to settle...
Dec 28 21:46:01 kaakeli /netbsd: sd0 at scsibus0 target 1 lun 0: <M-Sys, DiskOnKey, 2.50> SCSI0 0/direct removable
Dec 28 21:46:01 kaakeli /netbsd: sd0: 125 MB, 125 cyl, 64 head, 32 sec, 512 bytes/sect x 256352 sectors

	The last one was successfull after adding the patch at the
	end, recompiling and rebooting. 

>How-To-Repeat:

	Insert 128 MB DiskOnKey device and it will print out sd0: mode
	sense (4) returned nonsense; using fictitious geometry etc and
	all reads to device seems to hung forever. 

>Fix:

Index: scsiconf.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/scsiconf.c,v
retrieving revision 1.174
diff -u -r1.174 scsiconf.c
--- scsiconf.c	2001/12/27 18:57:46	1.174
+++ scsiconf.c	2001/12/30 17:11:41
@@ -592,6 +592,9 @@
 	 "M-Sys", "DiskOnKey",           "2.01"}, PQUIRK_NOMODESENSE
 	      | PQUIRK_NODOORLOCK | PQUIRK_ONLYBIG | PQUIRK_NOBIGMODESENSE},
 	{{T_DIRECT, T_REMOV,
+	 "M-Sys", "DiskOnKey",           "2.50"}, PQUIRK_NOMODESENSE
+	      | PQUIRK_NODOORLOCK | PQUIRK_ONLYBIG | PQUIRK_NOBIGMODESENSE},
+	{{T_DIRECT, T_REMOV,
 	 "INSITE", "I325VM",             ""},
 				PQUIRK_NOLUNS|PQUIRK_NODOORLOCK},
 	{{T_DIRECT, T_REMOV,

>Release-Note:
>Audit-Trail:
>Unformatted:
 
 NetBSD-current 2001-12-28.