Google
  Web www.spinics.net

Re: Read errors on Flash Drive Transcend TS1GJF2A

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Thu, 11 Oct 2007, RTE wrote:

> On Fri, 31 Aug 2007 22:39:40 +0400, Alan Stern wrote:
> 
> > There's a good chance that your problem isn't caused by anything in the
> > USB stack, but rather by a change somewhere else.
> 
> I did not use Git (150 MB is too much for my unstable internet connection to download at once), but I find the source of my problem.
> The problem is in these files:
> 
> include/scsi/scsi_cmnd.h
> drivers/scsi/scsi_lib.c
> drivers/scsi/sd.c
> 
> I replaced these files in linux-2.6.17-git22 with the same from linux-2.6.17-git21 and errors disappeared.

Okay.  That narrows it down to a single patch, this one:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=03aba2f79594ca94d159c8bab454de9bcc385b76

I'd like you to try some more experiments to determine what is wrong 
with that patch.  Below is a diagnostic patch which should print some 
useful information in the system log when one of those read errors 
occurs.  This patch should be applied to a working kernel, such as 
2.6.17-git21.

When we have the information from this, I'll send you a comparable 
diagnostic patch for 2.6.17-git22.  The differences ought to indicate 
where the bug lies.

(By the way, I can't easily test-compile this patch on my machine.  
It looks okay, but there might be something wrong with it.)

Alan Stern



--- 2.6.17/drivers/scsi/sd.c0	2007-10-11 15:52:58.000000000 -0400
+++ 2.6.17/drivers/scsi/sd.c	2007-10-11 16:10:34.000000000 -0400
@@ -923,6 +923,8 @@ static void sd_rw_intr(struct scsi_cmnd 
 	 */
 	if (driver_byte(result) != 0 &&
 		 sense_valid && !sense_deferred) {
+printk(KERN_INFO "driver_byte %x, sense key %x\n", driver_byte(result),
+sshdr.sense_key);
 		switch (sshdr.sense_key) {
 		case MEDIUM_ERROR:
 			if (!blk_fs_request(SCpnt->request))
@@ -962,6 +964,9 @@ static void sd_rw_intr(struct scsi_cmnd 
 
 			error_sector &= ~(block_sectors - 1);
 			good_bytes = (error_sector - SCpnt->request->sector) << 9;
+printk(KERN_INFO "error_sector %d, req_sector %d, resid %d, underflow %d\n",
+(int) error_sector, (int) SCpnt->request->sector, (int) SCpnt->resid,
+(int) SCpnt->underflow);
 			if (good_bytes < 0 || good_bytes >= this_count)
 				good_bytes = 0;
 			break;
@@ -998,6 +1003,9 @@ static void sd_rw_intr(struct scsi_cmnd 
 	 * how many actual sectors finished, and how many sectors we need
 	 * to say have failed.
 	 */
+if (good_bytes != this_count)
+printk(KERN_INFO "Adjusted good_bytes from %d to %d, block_sectors %d\n",
+this_count, good_bytes, (int) block_sectors);
 	scsi_io_completion(SCpnt, good_bytes, block_sectors << 9);
 }
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-usb-users@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

[Linux USB]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Video Projectors]     [PDAs]     [Free Online Dating]     [Hacking TiVo]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]     [16.7MP]