Re: [linux-usb-devel] [2.6-test] Bug in usb-storage or scsi?

From: Georgi Chorbadzhiyski
Date: Tue Sep 09 2003 - 16:20:08 EST


Alan Stern wrote:
On Tue, 9 Sep 2003, Georgi Chorbadzhiyski wrote:
I was able to access my Music Pen mp3 player using usb-storage driver
in 2.4 without any problems. After updating to 2.6 this was not possible
anymore. It seems that usb-storage driver in 2.6 detect the device but
I was unable to access /dev/sda1. "mount -t vfat /dev/sda1 /mnt" returns
this error: "mount: /dev/sda1 is not a valid block device"

Under 2.4.21-ck3, sda1 is corectly registered.

Please see the attached files containing dmesg snippets from 2.4 and 2.6
kerneles as well as 2.6 config. If you need more information I'll be glad
to provide it.

The 2.4 kernel that I tested was 2.4.21-ck3
The 2.6 kernel that I tested was 2.6.0-test5-mm1, 2.6.0-test4 and 2.6.0-test1


More problems with that stupid MODE-SENSE cache page! There are so many USB storage devices that have problems with that -- I wonder if it's worth the effort to try to continue supporting it?

Georgi, the problem is with your mp3 player, not usb-storage or SCSI. It's crashing when given a perfectly legal SCSI command. Linux 2.4
doesn't issue the command; that's why it works okay.

Well it probably is tested only with windows, so it's no suprise that
device's USB implementation is buggy.

If you want a temporary fix for 2.6.0, you can do this: Edit the routine sd_read_cache_type in the file drivers/scsi/sd.c (near line 1100). Get rid of (or #ifdef out) most of the function; just leave the last few lines where it does:

printk(KERN_ERR "%s: assuming drive cache: write through\n",
diskname);
sdkp->WCE = 0;
sdkp->RCD = 0;

You might want to change the KERN_ERR to KERN_NOTICE.

Thanks a lot! That worked fine! Now the device is detected and working.

Ugly patch is attached for reference. I hope some workaround for this kind
of buggy devices is developed in the future. Thank again.

However, you might also want to think twice before doing this if you have any other SCSI disks, because making this change will affect all of them.

--
Georgi Chorbadzhiyski
http://georgi.cybcom.net/
--- linux-2.6.0-test5/drivers/scsi/sd-org.c 2003-09-09 23:58:43.000000000 +0300
+++ linux-2.6.0-test5/drivers/scsi/sd.c 2003-09-10 00:11:21.000000000 +0300
@@ -1098,6 +1098,7 @@
static void
sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
struct scsi_request *SRpnt, unsigned char *buffer) {
+#if 0
int len = 0, res;

const int dbd = 0; /* DBD */
@@ -1150,6 +1151,11 @@
sdkp->WCE = 0;
sdkp->RCD = 0;
}
+#endif
+ printk(KERN_NOTICE "%s: assuming drive cache: write through\n",
+ diskname);
+ sdkp->WCE = 0;
+ sdkp->RCD = 0;
}

/**