Skip to contentSkip to conversation

long-term regression with some usb mass storage devices

DISCUSSION Mike Lampard 2 participants 6 messages Feb 20, 2009 – Feb 21, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi All,

I recently plonked a dvd into my usb-attached Pioneer DVR-107d only to find that the current kernels no longer saw the drive as DVD capable. In fact, the kernel no longer saw _any_ features of the drive: sr0: scsi3-mmc drive: 0x/0x caddy. After much bisecting and even more blind luck I narrowed the problem down to this commit:

commit bdb2b8cab4392ce41ddfbd6773a3da3334daf836

Author: Alan Stern <[email protected]>
Date:   Tue Jun 24 14:03:14 2008 -0400

[SCSI] erase invalid data returned by device

This patch (as1108) fixes a problem that can occur with certain USB mass-storage devices: They return invalid data together with a residue indicating that the data should be ignored. Rather than leave the invalid data in a transfer buffer, where it can get misinterpreted, the patch clears the invalid portion of the buffer.

This solves a problem (wrong write-protect setting detected) reported by Maciej Rutecki and Peter Teoh.

Regards
Mike

#1 lore raw

added CC

Quoted 30 lines · Mike Lampard

Hi All,

I recently plonked a dvd into my usb-attached Pioneer DVR-107d only to find that the current kernels no longer saw the drive as DVD capable. In fact, the kernel no longer saw _any_ features of the drive: sr0: scsi3-mmc drive:
0x/0x caddy. After much bisecting and even more blind luck I narrowed the problem down to this commit:

commit bdb2b8cab4392ce41ddfbd6773a3da3334daf836

Author: Alan Stern <[email protected]>
Date:   Tue Jun 24 14:03:14 2008 -0400

[SCSI] erase invalid data returned by device

This patch (as1108) fixes a problem that can occur with certain USB mass-storage devices: They return invalid data together with a residue indicating that the data should be ignored. Rather than leave the invalid data in a transfer buffer, where it can get misinterpreted, the patch clears the invalid portion of the buffer.

This solves a problem (wrong write-protect setting detected) reported by Maciej Rutecki and Peter Teoh.

Regards
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

maintainer
#2 lore raw
Quoted 15 lines · Mike Lampard
Quoted 14 lines · Mike Lampard

Hi All,

I recently plonked a dvd into my usb-attached Pioneer DVR-107d only to find that the current kernels no longer saw the drive as DVD capable. In fact, the kernel no longer saw _any_ features of the drive: sr0: scsi3-mmc drive:
0x/0x caddy. After much bisecting and even more blind luck I narrowed the problem down to this commit:

commit bdb2b8cab4392ce41ddfbd6773a3da3334daf836

Author: Alan Stern <[email protected]>
Date:   Tue Jun 24 14:03:14 2008 -0400

[SCSI] erase invalid data returned by device

Quoted 8 lines
Quoted 8 lines

This patch (as1108) fixes a problem that can occur with certain USB mass-storage devices: They return invalid data together with a residue indicating that the data should be ignored. Rather than leave the invalid data in a transfer buffer, where it can get misinterpreted, the patch clears the invalid portion of the buffer.

This solves a problem (wrong write-protect setting detected) reported by Maciej Rutecki and Peter Teoh.

If this affected your device then the device must not report residues correctly. If you provide the device's entry in /proc/bus/usb/devices, I'll write a patch adding a blacklist entry for it.

It would help if you could also provide a usbmon trace showing what happens when you plug the drive in. Instructions are in the kernel source file Documentation/usb/usbmon.txt.

Alan Stern

#3 lore raw
Quoted 22 lines · Alan Stern
Quoted 21 lines · Mike Lampard
Quoted 20 lines · Mike Lampard

Hi All,

I recently plonked a dvd into my usb-attached Pioneer DVR-107d only to find that the current kernels no longer saw the drive as DVD capable. In fact, the kernel no longer saw _any_ features of the drive: sr0:
scsi3-mmc drive: 0x/0x caddy. After much bisecting and even more blind luck I narrowed the problem down to this commit:

commit bdb2b8cab4392ce41ddfbd6773a3da3334daf836

Author: Alan Stern <[email protected]>
Date:   Tue Jun 24 14:03:14 2008 -0400

[SCSI] erase invalid data returned by device

This patch (as1108) fixes a problem that can occur with certain USB mass-storage devices: They return invalid data together with a
residue indicating that the data should be ignored. Rather than leave the invalid data in a transfer buffer, where it can get misinterpreted, the patch clears the invalid portion of the buffer.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

This solves a problem (wrong write-protect setting detected)
reported by Maciej Rutecki and Peter Teoh.

If this affected your device then the device must not report residues correctly. If you provide the device's entry in /proc/bus/usb/devices, I'll write a patch adding a blacklist entry for it.

Many thanks.

Quoted 3 lines

It would help if you could also provide a usbmon trace showing what happens when you plug the drive in. Instructions are in the kernel source file Documentation/usb/usbmon.txt.

/proc/bus/usb/devices:

T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=05e3 ProdID=0701 Rev= 0.02
S:  Manufacturer=Genesyslogic
S:  Product=USB Mass Storage Device
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 96mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=125us

I'll email the usbmod log directly, to save spamming the list with a 100kb attachment.

Mike

maintainer
#4 lore raw
Quoted 11 lines · Mike Lampard
Quoted 3 lines

If this affected your device then the device must not report residues correctly. If you provide the device's entry in /proc/bus/usb/devices, I'll write a patch adding a blacklist entry for it.

Many thanks.

Quoted 3 lines

It would help if you could also provide a usbmon trace showing what happens when you plug the drive in. Instructions are in the kernel source file Documentation/usb/usbmon.txt.

/proc/bus/usb/devices:

Quoted 9 lines
T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=05e3 ProdID=0701 Rev= 0.02
S:  Manufacturer=Genesyslogic
S:  Product=USB Mass Storage Device
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 96mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=125us

Ah, more fun from our friends at Genesys Logic. :-(

Quoted 2 lines

I'll email the usbmod log directly, to save spamming the list with a 100kb attachment.

This seems to be the critical part:

ffff88002ad42300 1207042173 S Bo:1:009:2 -115 31 = 55534243 08000000 80000000 80000a5a 002a0000 00000080 00000000 000000 ffff88002ad42300 1207042287 C Bo:1:009:2 0 31 >
ffff88001dc5e780 1207042452 S Bi:1:009:1 -115 128 <
ffff88001dc5e780 1207046917 C Bi:1:009:1 -121 72 = 00467000 00000000 2a3e3f17 f1632923 1b900100 07d01b90 00001089 10890001 ffff88002ad42300 1207048482 S Bi:1:009:1 -115 13 <
ffff88002ad42300 1207048917 C Bi:1:009:1 -32 0
ffff88002ad42300 1207049111 S Co:1:009:0 s 02 01 0000 0081 0000 0
ffff88002ad42300 1207050037 C Co:1:009:0 0 0
ffff88002ad42300 1207050269 S Bi:1:009:1 -115 13 <
ffff88002ad42300 1207050910 C Bi:1:009:1 0 13 = 55534253 08000000 80000000 00

This shows the computer sending a MODE SENSE command for page 0x2a (the MultiMedia Capabilities and Mechanical Status page), asking for 128 bytes of information. The drive sent back 72 bytes followed by a residue of 128, indicating that none of the data was valid.

Presumably the data really was valid and the residue should have been
56. On the other hand, we have never had any other reports of invalid residues from a Genesys Logic controller. Maybe the error actually came from the attached Pioneer drive instead of the controller; there's no way to tell unless you attach a different kind of drive to the controller.

Anyway, this patch may fix the problem. Let me know what happens with it. I'm a little hesitant to add it to the kernel, because of the significant probability that the Genesys Logic controller itself is okay.

Starting with 2.6.29 you'll be able to add special flags like this at runtime without the need for any patches, by means of a module parameter for usb-storage.

Alan Stern

drivers/usb/storage/unusual_devs.h +2 -2
Index: usb-2.6/drivers/usb/storage/unusual_devs.h
===================================================================
@@ -802,13 +802,13 @@ UNUSUAL_DEV(  0x05e3, 0x0701, 0x0000, 0x
 		"Genesys Logic",
 		"USB to IDE Optical",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
+		US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
 
 UNUSUAL_DEV(  0x05e3, 0x0702, 0x0000, 0xffff,
 		"Genesys Logic",
 		"USB to IDE Disk",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
+		US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
 
 /* Reported by Ben Efros <[email protected]> */
 UNUSUAL_DEV(  0x05e3, 0x0723, 0x9451, 0x9451,
#5 lore raw
Quoted 48 lines · Alan Stern
Quoted 11 lines · Mike Lampard
Quoted 3 lines

If this affected your device then the device must not report residues correctly. If you provide the device's entry in /proc/bus/usb/devices, I'll write a patch adding a blacklist entry for it.

Many thanks.

Quoted 3 lines

It would help if you could also provide a usbmon trace showing what happens when you plug the drive in. Instructions are in the kernel source file Documentation/usb/usbmon.txt.

/proc/bus/usb/devices:

Quoted 9 lines
T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=05e3 ProdID=0701 Rev= 0.02
S:  Manufacturer=Genesyslogic
S:  Product=USB Mass Storage Device
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 96mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=125us

Ah, more fun from our friends at Genesys Logic. :-(

Quoted 2 lines

I'll email the usbmod log directly, to save spamming the list with a 100kb attachment.

This seems to be the critical part:

ffff88002ad42300 1207042173 S Bo:1:009:2 -115 31 = 55534243 08000000 80000000 80000a5a 002a0000 00000080 00000000 000000 ffff88002ad42300 1207042287 C Bo:1:009:2 0 31 >
ffff88001dc5e780 1207042452 S Bi:1:009:1 -115 128 < ffff88001dc5e780 1207046917 C Bi:1:009:1 -121 72 = 00467000 00000000 2a3e3f17 f1632923 1b900100 07d01b90 00001089 10890001 ffff88002ad42300 1207048482 S Bi:1:009:1 -115 13 <
ffff88002ad42300 1207048917 C Bi:1:009:1 -32 0 ffff88002ad42300 1207049111 S Co:1:009:0 s 02 01 0000 0081 0000 0 ffff88002ad42300 1207050037 C Co:1:009:0 0 0
ffff88002ad42300 1207050269 S Bi:1:009:1 -115 13 < ffff88002ad42300 1207050910 C Bi:1:009:1 0 13 = 55534253 08000000 80000000 00

This shows the computer sending a MODE SENSE command for page 0x2a (the MultiMedia Capabilities and Mechanical Status page), asking for 128 bytes of information. The drive sent back 72 bytes followed by a residue of 128, indicating that none of the data was valid.

Quoted 6 lines

Presumably the data really was valid and the residue should have been
56. On the other hand, we have never had any other reports of invalid residues from a Genesys Logic controller. Maybe the error actually came from the attached Pioneer drive instead of the controller; there's no way to tell unless you attach a different kind of drive to the controller.

I've now tested two other DVD writers in this adapter without the patch - one LG and the other a much newer Pioneer. Both exhibit the identical symptoms.

Quoted 4 lines

Anyway, this patch may fix the problem. Let me know what happens with it. I'm a little hesitant to add it to the kernel, because of the significant probability that the Genesys Logic controller itself is okay.

The patch worked flawlessly with all devices I tested it on. I also tested a HDD in the cradle to ensure there were no obvious regressions in that regard, it too worked as it should.

Quoted 3 lines

Starting with 2.6.29 you'll be able to add special flags like this at runtime without the need for any patches, by means of a module parameter for usb-storage.

If you do decide to commit the change to the kernel, any chance you could mark it for the stable releases?

Cheers
Mike