Re: usb hdd problems with 2.6.27.2

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: James Bottomley
Date: Saturday, October 25, 2008 - 1:11 pm

On Sat, 2008-10-25 at 15:50 -0400, Alan Stern wrote:

Try reversing this patch (apply with patch -p1 -R)

James

---

commit 10dab22664914505dcb804d9ad09cad6bc94d349
Author: Jamie Wellnitz <Jamie.Wellnitz@emulex.com>
Date:   Thu Sep 11 21:39:36 2008 -0400

    [SCSI] sd: Fix handling of NO_SENSE check condition
    
    The current handling of NO_SENSE check condition is the same as
    RECOVERED_ERROR, and assumes that in both cases, the I/O was fully
    transferred.
    
    We have seen cases of arrays returning with NO_SENSE (no error), but
    the I/O was not completely transferred, thus residual set.  Thus,
    rather than return good_bytes as the entire transfer, set good_bytes
    to 0, so that the midlayer then applies the residual in calculating
    the transfer, and for sd, will fail the I/O and fall into a retry
    path.
    
    Signed-off-by: Jamie Wellnitz <Jamie.Wellnitz@emulex.com>
    Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 7c4d2e6..55e6ed4 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1054,7 +1054,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 		good_bytes = sd_completed_bytes(SCpnt);
 		break;
 	case RECOVERED_ERROR:
-	case NO_SENSE:
 		/* Inform the user, but make sure that it's not treated
 		 * as a hard error.
 		 */
@@ -1063,6 +1062,15 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 		memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 		good_bytes = scsi_bufflen(SCpnt);
 		break;
+	case NO_SENSE:
+		/* This indicates a false check condition, so ignore it.  An
+		 * unknown amount of data was transferred so treat it as an
+		 * error.
+		 */
+		scsi_print_sense("sd", SCpnt);
+		SCpnt->result = 0;
+		memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
+		break;
 	case ABORTED_COMMAND:
 		if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */
 			scsi_print_result(SCpnt);


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
usb hdd problems with 2.6.27.2, Luciano Rocha, (Wed Oct 22, 9:22 am)
Re: usb hdd problems with 2.6.27.2, Rafael J. Wysocki, (Sat Oct 25, 12:25 pm)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Sat Oct 25, 12:50 pm)
Re: usb hdd problems with 2.6.27.2, James Bottomley, (Sat Oct 25, 1:11 pm)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Sun Oct 26, 7:05 am)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Mon Oct 27, 4:14 am)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Mon Oct 27, 4:28 am)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Mon Oct 27, 7:24 am)
Re: usb hdd problems with 2.6.27.2, Douglas Gilbert, (Mon Oct 27, 7:56 am)
Re: usb hdd problems with 2.6.27.2, Boaz Harrosh, (Mon Oct 27, 8:08 am)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Mon Oct 27, 8:18 am)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Mon Oct 27, 8:25 am)
Re: usb hdd problems with 2.6.27.2, James Bottomley, (Mon Oct 27, 8:33 am)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Mon Oct 27, 8:38 am)
Re: usb hdd problems with 2.6.27.2, Kay Sievers, (Mon Oct 27, 9:26 am)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Mon Oct 27, 9:53 am)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Mon Oct 27, 1:10 pm)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Mon Oct 27, 1:36 pm)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Tue Oct 28, 9:37 am)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Tue Oct 28, 10:38 am)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Mon Nov 3, 8:52 am)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Mon Nov 3, 12:46 pm)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Wed Nov 5, 3:26 am)
Re: usb hdd problems with 2.6.27.2, Alan Stern, (Wed Nov 5, 9:51 am)
Re: usb hdd problems with 2.6.27.2, Luciano Rocha, (Thu Nov 13, 10:10 am)