From: Boaz Harrosh <bharrosh@panasas.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Douglas Gilbert <dougg@torque.net>,
USB Storage list <usb-storage@lists.one-eyed-alien.net>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
Matthieu castet <castet.matthieu@free.fr>
Subject: Re: [usb-storage] USB storage devices and SAT
Date: Tue, 05 Aug 2008 18:10:10 +0300 [thread overview]
Message-ID: <48986D52.7030109@panasas.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0808051047130.2518-100000@iolanthe.rowland.org>
Alan Stern wrote:
> On Tue, 5 Aug 2008, Boaz Harrosh wrote:
>
>> There was a correct and simple patch proposed that fixes this problem
>> the right way:
>> http://marc.info/?l=linux-usb&m=121762869915609&w=2
>>
>> Doug could you please test this patch to see if it fixes your device?
>>
>> scsi-core already gives drivers complete control on what sense_size to
>> fetch. It is a parameter to the scsi_eh_prep_cmnd() call. So no need
>> for slave_configure(), default value, and all that loop.
>
>>> http://thread.gmane.org/gmane.linux.utilities.smartmontools/5721
>>> Index: linux-2.6/drivers/usb/storage/scsiglue.c
>>> ===================================================================
>>> --- linux-2.6.orig/drivers/usb/storage/scsiglue.c 2008-08-02 00:07:24.000000000 +0200
>>> +++ linux-2.6/drivers/usb/storage/scsiglue.c 2008-08-02 00:07:37.000000000 +0200
>>> @@ -170,6 +170,10 @@
>>> if (us->fflags & US_FL_CAPACITY_HEURISTICS)
>>> sdev->guess_capacity = 1;
>>>
>>> + /* assume SPC3 or latter device support sense size different of 18 */
>>> + if (sdev->scsi_level > SCSI_SPC_2)
>>> + us->fflags |= US_FL_SANE_SENSE;
>>> +
>>> /* Some devices report a SCSI revision level above 2 but are
>>> * unable to handle the REPORT LUNS command (for which
>>> * support is mandatory at level 3). Since we already have
>>> Index: linux-2.6/drivers/usb/storage/transport.c
>>> ===================================================================
>>> --- linux-2.6.orig/drivers/usb/storage/transport.c 2008-08-02 00:07:24.000000000 \
>>> +0200
>>> +++ linux-2.6/drivers/usb/storage/transport.c 2008-08-02 00:07:37.000000000 +0200
>>> @@ -595,10 +595,15 @@
>>> if (need_auto_sense) {
>>> int temp_result;
>>> struct scsi_eh_save ses;
>>> + int sense_size = US_SENSE_SIZE;
>>> +
>>> + /* device support and need bigger sense buffer */
>>> + if (us->fflags & US_FL_SANE_SENSE)
>>> + sense_size = ~0;
>
> This looks highly suspicious at best. Shouldn't sense_size be set to a
> real value, like 22 or 255?
>
No this is the regular way to signal from a driver that we support
whatever the scsi-ml or application decided. So ~0 means, effectively,
scsi's default which is 96. But can change in future with no changes
to drivers.
(BTW ~0 is used everywhere in Kernel but here)
Don't just hard code what ever you want. the maximum sense_size mandated
by scsi standard is 260. The current midlayer uses 96 every where. If
the driver has specific needs, like 18 with broken devices, do so but please
don't hard code to arbitrary value.
>
>> I recommend this patch. It does exactly what's needed with minimum risk
>> it is even maybe over protective, with the white list. Perhaps it should
>> be turned to a black list instead. The old broken devices been an extincting
>> exception.
>
> Changing it to a blacklist would be bad -- in fact it would be a
> regression, because all the deficient devices which used to work would
> stop working until they were identified and added to the blacklist.
>
> Apart from the one nit above, I agree that this patch looks sensible.
>
> Alan Stern
>
Thanks
Boaz
next prev parent reply other threads:[~2008-08-05 15:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 1:10 USB storage devices and SAT Douglas Gilbert
2008-08-04 1:33 ` James Bottomley
2008-08-04 2:18 ` [usb-storage] " Matthew Dharm
2008-08-04 2:21 ` Matthew Dharm
2008-08-04 8:31 ` Boaz Harrosh
2008-08-04 15:21 ` Matthew Dharm
2008-08-04 15:51 ` Alan Stern
2008-08-04 17:45 ` [usb-storage] " Matthew Dharm
2008-08-05 11:54 ` Boaz Harrosh
2008-08-05 14:51 ` Alan Stern
2008-08-05 15:10 ` Boaz Harrosh [this message]
2008-08-05 15:34 ` Douglas Gilbert
2008-08-05 15:57 ` Boaz Harrosh
2008-08-05 16:09 ` Boaz Harrosh
2008-08-05 17:42 ` matthieu castet
2008-09-07 19:35 ` matthieu castet
2008-09-08 7:27 ` Boaz Harrosh
-- strict thread matches above, loose matches on Subject: below --
2008-08-04 10:08 castet.matthieu
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=48986D52.7030109@panasas.com \
--to=bharrosh@panasas.com \
--cc=castet.matthieu@free.fr \
--cc=dougg@torque.net \
--cc=linux-scsi@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/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