Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752015AbYJYULs (ORCPT ); Sat, 25 Oct 2008 16:11:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750876AbYJYULi (ORCPT ); Sat, 25 Oct 2008 16:11:38 -0400 Received: from accolon.hansenpartnership.com ([76.243.235.52]:51321 "EHLO accolon.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750813AbYJYULh (ORCPT ); Sat, 25 Oct 2008 16:11:37 -0400 Subject: Re: usb hdd problems with 2.6.27.2 From: James Bottomley To: Alan Stern Cc: Luciano Rocha , "Rafael J. Wysocki" , Linux-Kernel , USB list , SCSI development list In-Reply-To: References: Content-Type: text/plain Date: Sat, 25 Oct 2008 15:11:33 -0500 Message-Id: <1224965493.3449.7.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2671 Lines: 77 On Sat, 2008-10-25 at 15:50 -0400, Alan Stern wrote: > On Sat, 25 Oct 2008, Rafael J. Wysocki wrote: > > > [Adding CCs] > > > > On Wednesday, 22 of October 2008, Luciano Rocha wrote: > > > > > > Hello, > > > > > > An external HDD, usb-encased, works fine under 2.6.26.5, but under > > > 2.6.27.2 I get hundreds of errors per second, of 'No Sense [current]'. > > You can use usbmon to capture the details of what happens when you plug > in the drive. Instructions are in the kernel source file > Documentation/usb/usbmon.txt. Try reversing this patch (apply with patch -p1 -R) James --- commit 10dab22664914505dcb804d9ad09cad6bc94d349 Author: Jamie Wellnitz 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 Signed-off-by: James Bottomley 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/