Re: [Linux-usb-users] Myson Century USB enclosure problem

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

 



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;

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux