public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Efros <ben@pc-doctor.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Josua Dietze <digidietze@draisberghof.de>,
	fangxiaozhi <huananhu@huawei.com>, Greg KH <greg@kroah.com>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	USB list <linux-usb@vger.kernel.org>,
	Hugh Blemings <hugh@blemings.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: USB serial regression 2.6.31.1 -> 2.6.31.2 [PATCH]
Date: Sun, 11 Oct 2009 09:16:38 -0700 (PDT)	[thread overview]
Message-ID: <7550119.564321255277798089.JavaMail.root@mail.pc-doctor.com> (raw)
In-Reply-To: <26767470.564301255277612694.JavaMail.root@mail.pc-doctor.com>


----- "Alan Stern" <stern@rowland.harvard.edu> wrote:
> On Sun, 11 Oct 2009, Benjamin Herrenschmidt wrote:
> 
> > 
> > > Further REQUEST SENSE commands therefore requested 96 bytes of
> data
> > > instead of the standard 18 bytes.  With LUN 0 this worked okay. 
> But 
> > > with LUN 1 it didn't; the device reported a failure of the REQUEST
> 
> > > SENSE.  This is what caused usb-storage to issue the device
> reset.
> > > 
> > > After the reset usb-storage continued to ask for 96 bytes of
> sense
> > > data, and LUN 1 continued to fail the commands.  Hence the
> repeated
> > > resets.
> > 
> > Maybe a better approach would be to go back to 18 bytes when it
> fails,
> > what do you think ?
> 
> We certainly could do that.  But should we turn off the SANE_SENSE
> flag 
> at the same time?

No I don't think its a good idea to turn off SANE_SENSE in this situation.  Here is a patch similar to Ben Herrenschmidt's but will not turn off SANE_SENSE just because a transport failure.


Retry with short sense when SANE_SENSE fails.

 Signed-off-by: Ben Efros <ben@pc-doctor.com>

--- linux-2.6.31.1/drivers/usb/storage/transport.c        2009-09-24 08:45:25.000000000 -0700
+++ linux-2.6.31.1.new/drivers/usb/storage/transport.c        2009-10-11 08:06:26.000000000 -0700
@@ -696,7 +696,7 @@ void usb_stor_invoke_transport(struct sc
                 /* device supports and needs bigger sense buffer */
                 if (us->fflags & US_FL_SANE_SENSE)
                         sense_size = ~0;
-
+Retry_Sense:
                 US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
 
                 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size);
@@ -723,6 +723,12 @@ void usb_stor_invoke_transport(struct sc
                 if (temp_result != USB_STOR_TRANSPORT_GOOD) {
                         US_DEBUGP("-- auto-sense failure\n");
 
+                        if ((us->fflags & US_FL_SANE_SENSE) &&
+                            sense_size != US_SENSE_SIZE) {
+                                sense_size = US_SENSE_SIZE;
+                                US_DEBUGP("-- retry without SANE_SENSE\n");
+                                goto Retry_Sense;
+                        }
                         /* we skip the reset if this happens to be a
                          * multi-target device, since failure of an
                          * auto-sense is perfectly valid



       reply	other threads:[~2009-10-11 16:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <26767470.564301255277612694.JavaMail.root@mail.pc-doctor.com>
2009-10-11 16:16 ` Ben Efros [this message]
2009-10-12  5:44   ` USB serial regression 2.6.31.1 -> 2.6.31.2 [PATCH] Benjamin Herrenschmidt
2009-10-12 14:58     ` Alan Stern
2009-10-12 15:12       ` Matthew Dharm
2009-10-12 15:18       ` Ben Efros
2009-10-12 21:19       ` Benjamin Herrenschmidt
2009-10-13  4:53       ` Benjamin Herrenschmidt
2009-10-13 14:03         ` Alan Stern
2009-10-13 23:30           ` Benjamin Herrenschmidt
2009-10-14  2:29             ` Greg KH
     [not found] <19395543.564391255279074897.JavaMail.root@mail.pc-doctor.com>
2009-10-11 16:38 ` Ben Efros
2009-10-11 20:51   ` Benjamin Herrenschmidt
2009-10-12  1:54     ` Alan Stern
2009-10-12  3:28       ` Benjamin Herrenschmidt
2009-10-12 14:27         ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7550119.564321255277798089.JavaMail.root@mail.pc-doctor.com \
    --to=ben@pc-doctor.com \
    --cc=benh@kernel.crashing.org \
    --cc=digidietze@draisberghof.de \
    --cc=greg@kroah.com \
    --cc=huananhu@huawei.com \
    --cc=hugh@blemings.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox