From: Douglas Gilbert <dougg@torque.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] Improve code for detecting errors near the end of a CD
Date: Fri, 21 Oct 2005 13:05:22 +1000 [thread overview]
Message-ID: <43585AF2.1080103@torque.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0510201159470.5676-100000@iolanthe.rowland.org>
Alan Stern wrote:
> On Thu, 20 Oct 2005, Douglas Gilbert wrote:
>
>
>>Alan,
>>Ouch.
>>Here is the linux kernel version (scsi_error.c):
>>
>> case 0x70:
>> case 0x71:
>> if (sense_buffer[0] & 0x80) {
>> *info_out = (sense_buffer[3] << 24) +
>> (sense_buffer[4] << 16) +
>> (sense_buffer[5] << 8) +
>> sense_buffer[6];
>> return 1;
>> } else
>> return 0;
>>
>>and here is the sg3_utils version (sg_lib.c):
>>
>> case 0x70:
>> case 0x71:
>> if (info_outp)
>> *info_outp = (sensep[3] << 24) + (sensep[4] << 16) +
>> (sensep[5] << 8) + sensep[6];
>> return (sensep[0] & 0x80) ? 1 : 0;
>>
>>The latter implementation takes account of MMC devices.
>>So I probably need to send a patch.
>
>
> I can see that the newer version always stores an information value. Are
> you suggesting that sr.c should ignore the return value and try to use
> info whenever it is nonzero and within the appropriate range? Or should
> the decision to use info when the return value is 0 be based somehow on
> other information about the device?
Alan,
The info field is optionally set for several SCSI
sense key values: medium and hardware error, perhaps
others. So if a ULD is invoking scsi_get_sense_info_fld()
I presume there is a good reason.
On disks I have seen the info field set to what looks
like the current lba when a REQUEST SENSE is sent
during a large transfer. The valid bit is clear
and the sense key is NO SENSE, so according to SBC
I regard that as a quaint response (but not an error).
The return value of scsi_get_sense_info_fld() should
be appropriately defined, that is it reflects whether
the "valid" bit is set.
I see the role of scsi_get_sense_info_fld() to yield as
much data as possible and let the ULD make the decision.
In the case of sr.c, it should be aware that due to
MMC not requiring the valid bit to be set, many
devices set the info field on a medium/hardware error
with the valid bit clear.
Note that for the "Information sense data descriptor"
(spc4r02 section 4.5.2.2) it is required that the valid
bit in there is set. Interestingly that was a change
introduced in spc3r22.pdf . So someone decided to stamp
on this fuzziness (when, in the future, devices switch
to descriptor sense format).
Doug Gilbert
next prev parent reply other threads:[~2005-10-21 3:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-14 20:07 [PATCH] Improve code for detecting errors near the end of a CD Alan Stern
2005-10-15 0:49 ` Douglas Gilbert
2005-10-15 2:36 ` Alan Stern
2005-10-15 3:35 ` Douglas Gilbert
2005-10-19 20:32 ` Alan Stern
2005-10-20 2:56 ` Douglas Gilbert
2005-10-20 16:04 ` Alan Stern
2005-10-21 3:05 ` Douglas Gilbert [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-09-29 18:44 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=43585AF2.1080103@torque.net \
--to=dougg@torque.net \
--cc=linux-scsi@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;
as well as URLs for NNTP newsgroup(s).