linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Thu, 20 Oct 2005 12:56:46 +1000	[thread overview]
Message-ID: <4357076E.2000006@torque.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0510191627270.4439-100000@iolanthe.rowland.org>

Alan Stern wrote:
> On Sat, 15 Oct 2005, Douglas Gilbert wrote:
> 
> 
>>Alan,
>>In include/scsi/scsi_eh.h there are several helper functions
>>to aid processing SCSI errors. This includes SCSI sense data
>>descriptor format (which won't be needed for DVD/HD/BD for
>>some time with a (2**32 * 2048) byte maximum using existing
>>fixed sense data format). However there is
>>scsi_get_sense_info_fld() to fetch the info field.
>>
>>sd, st and sg have been converted to use these helpers,
>>where appropriate.
>>
>>MMC-4 does not mention that the valid bit needs to
>>be set on a MEDIUM/HARDWARE error and I have seen
>>real life examples of this. [So it's poorly defined
>>if one gets a medium error on lba 0.] You may also like to
>>consider deferred errors which can occur according to
>>MMC-4.
> 
> 
> I just read the scsi_get_sense_info_fld routine.  For fixed format data, 
> it won't return anything if the Valid bit isn't set!
> 
> This makes it hard to adopt both your first two suggestions... :-)

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.

Doug Gilbert



  reply	other threads:[~2005-10-20  2:55 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 [this message]
2005-10-20 16:04       ` Alan Stern
2005-10-21  3:05         ` Douglas Gilbert
  -- 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=4357076E.2000006@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).