All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Myson Century USB enclosure problem
       [not found] <20051119205222.GA3851@one-eyed-alien.net>
@ 2005-11-20  1:52 ` Alan Stern
  2005-11-20  8:17   ` Chuan-kai Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2005-11-20  1:52 UTC (permalink / raw)
  To: Chuan-kai Lin; +Cc: Matthew Dharm, USB users list, SCSI development list

On Sat, 19 Nov 2005, Matthew Dharm wrote:

> Do you have MD or other advanced partition features turned on?  If so,
> turning them off might help.
> 
> Matt

That could well help, but it doesn't solve the underlying problem.  I've
thought for a long time that this could bite someone, but it's the first 
time I've seen an actual example.

When asked to read the last 8 sectors on the disk, your drive returned all
but the last 64 bytes of data and then for some reason complained that the
command was invalid (it wasn't).  The SCSI core retried exactly the same
command, and the second time it succeeded.  But meanwhile the SCSI core
thought the error message indicated that the drive prefers 6-byte
READ/WRITE commands instead of the ususal 10-byte form.  So it switched
over to using 6-byte commands, and from then on the drive didn't work at
all.

The patch below is a first step toward correcting the problem.  It makes 
the SCSI core revert back to using the 10-byte commands when the 6-byte 
version gets an error.  This isn't a final solution, because there's a 
possibility it could lead to an infinite retry loop if the drive doesn't 
like either the 6- or 10-byte command form.  But at least it's a start.

Alan Stern


--- a/drivers/scsi/scsi_lib.c	Mon Nov 14 09:46:18 2005
+++ b/drivers/scsi/scsi_lib.c	Sat Nov 19 20:40:13 2005
@@ -894,6 +894,16 @@
 				 */
 				scsi_requeue_command(q, cmd);
 				result = 0;
+			} else if (!cmd->device->use_10_for_rw &&
+			    (cmd->cmnd[0] == READ_6 ||
+			     cmd->cmnd[0] == WRITE_6)) {
+				cmd->device->use_10_for_rw = 1;
+				/*
+				 * This will cause a retry with a 10-byte
+				 * command.
+				 */
+				scsi_requeue_command(q, cmd);
+				result = 0;
 			} else {
 				scsi_end_request(cmd, 0, this_count, 1);
 				return;



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Myson Century USB enclosure problem
  2005-11-20  1:52 ` Myson Century USB enclosure problem Alan Stern
@ 2005-11-20  8:17   ` Chuan-kai Lin
  2005-11-20 15:14     ` [Linux-usb-users] " Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: Chuan-kai Lin @ 2005-11-20  8:17 UTC (permalink / raw)
  To: linux-usb-users; +Cc: linux-scsi

In gmane.linux.usb.user Alan Stern <stern@rowland.harvard.edu> wrote:
> The patch below is a first step toward correcting the problem.  It makes 
> the SCSI core revert back to using the 10-byte commands when the 6-byte 
> version gets an error.  This isn't a final solution, because there's a 
> possibility it could lead to an infinite retry loop if the drive doesn't 
> like either the 6- or 10-byte command form.  But at least it's a start.

Thanks for the patch and the explanation.  I have applied the patch and
posted the usb-storage debug output in the same directory.

  http://www.cs.pdx.edu/~cklin/usb-error/

The kernel still failed to read the partition table.  However, to my
untrained eyes, the log indicates that the SCSI core did revert back to
10-byte commands, so we are making progress.

Thanks,

-- 
Chuan-kai Lin
http://www.cs.pdx.edu/~cklin/



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Linux-usb-users] Re: Myson Century USB enclosure problem
  2005-11-20  8:17   ` Chuan-kai Lin
@ 2005-11-20 15:14     ` Alan Stern
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2005-11-20 15:14 UTC (permalink / raw)
  To: Chuan-kai Lin; +Cc: linux-usb-users, linux-scsi

On Sun, 20 Nov 2005, Chuan-kai Lin wrote:

> Thanks for the patch and the explanation.  I have applied the patch and
> posted the usb-storage debug output in the same directory.
> 
>   http://www.cs.pdx.edu/~cklin/usb-error/
> 
> The kernel still failed to read the partition table.  However, to my
> untrained eyes, the log indicates that the SCSI core did revert back to
> 10-byte commands, so we are making progress.

It did switch back, and as far as the log shows, everything is now working
correctly.  That error message about "unable to read partition table" is
misleading; the kernel _was_ able to read the partition table.  It just
wasn't able to understand the contents.  You may need to run fdisk to 
check and reinitialize the partition table.

Alan Stern


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-20 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20051119205222.GA3851@one-eyed-alien.net>
2005-11-20  1:52 ` Myson Century USB enclosure problem Alan Stern
2005-11-20  8:17   ` Chuan-kai Lin
2005-11-20 15:14     ` [Linux-usb-users] " Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.