[Bug 191717] [iscsi] smartctl -H gives "ATA output registers missing" for a disk using the isci driver
Douglas Gilbert
dgilbert at interlog.com
Wed Jul 9 18:23:20 UTC 2014
On 14-07-09 12:44 PM, Jim Harris wrote:
>
>
>
> On Tue, Jul 8, 2014 at 10:43 AM, Douglas Gilbert <dgilbert at interlog.com
> <mailto:dgilbert at interlog.com>> wrote:
>
> On 14-07-08 07:45 AM, Martin Simmons wrote:
>
> On Mon, 07 Jul 2014 23:12:27 -0400, Douglas Gilbert
> said:
>
>
> On 14-07-07 09:45 PM, bugzilla-noreply at freebsd.org
> <http://freebsd.org> wrote:
>
> https://bugs.freebsd.org/__bugzilla/show_bug.cgi?id=__191717
> <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191717>
>
> Mark Linimon <linimon at FreeBSD.org> changed:
>
> What |Removed |Added
> ------------------------------__------------------------------__----------------
> Assignee|freebsd-bugs at FreeBSD.org
> |freebsd-scsi at FreeBSD.org
> Summary|smartctl -H gives "ATA |[iscsi]
> smartctl -H gives
> |output registers missing" |"ATA output
> registers
> |for a disk using the isci |missing" for
> a disk using
> |driver |the isci driver
>
> --- Comment #1 from Mark Linimon <linimon at FreeBSD.org> ---
> Over to maintainers.
>
>
> At the point of failure "whatever" produces this SCSI sense data:
> f0 00 01 00 50 40 00 00 00 c2 4f 00 00 1d 00 00 00 00
>
> FreeBSD is wrong to print out 18 bytes because that is an 8
> byte (deferred, fixed type) buffer because byte 7 (the
> additional length) is 0. Whatever produced that broken
> sense data is the probably culprit.
>
> It is trying to say there is "ATA pass-through information
> available" but fails to get its message across.
>
>
> Hi,
>
> I'm the original reporter.
>
> The sense data is smartctl's interpretation of the ccb union.
>
> In particular, the bytes are from ccb->csio.sense_data and it calculates 18
> from ccb->csio.sense_len - ccb->csio.sense_resid (32 - 14). I don't know if
> that is correct or not.
>
> FWIW, here is the output from CentOS 6.3 on the same machine:
>
> REPORT-IOCTL: Device=/dev/sdc Command=SMART STATUS CHECK
> Input: FR=0xda, SC=...., LL=...., LM=0x4f, LH=0xc2, DEV=...., CMD=0xb0
> [ata pass-through(16): 85 06 2c 00 da 00 00 00 00 00 4f 00 c2 00 b0 00 ]
> scsi_status=0x2, host_status=0x0, driver_status=0x8
> info=0x1 duration=17 milliseconds resid=0
> >>> Sense buffer, len=22:
> 00 72 00 00 00 00 00 00 0e 09 0c 00 00 00 00 00 00
> 10 00 4f 00 c2 40 50
> status=2: [desc] sense_key=0 asc=0 ascq=0
> Values from ATA Return Descriptor are:
> 00 09 0c 00 00 00 00 00 00 00 4f 00 c2 40 50
> [Duration: 0.016s]
> Output: ERR=0x00, SC=0x00, LL=0x00, LM=0x4f, LH=0xc2, DEV=0x40, STS=0x50
> REPORT-IOCTL: Device=/dev/sdc Command=SMART STATUS CHECK returned 0
>
> It appears to have the same ata pass-through command but completely
> different
> sense data.
>
>
> The SAT standard originally only defined "descriptor" sense
> data format for passing back ATA errors and warning. That is
> what is being done properly in the Centos 6.3 output that
> you have shown above.
>
> More recently someone at T10 objected that SAT ignored the D_SENSE
> flag which allows an application client to choose whether it wants
> "fixed" or "descriptor" sense data format. It looks like the FreeBSD
> case is trying to produce the equivalent "fixed" sense data, but it
> fails to format it properly.
>
> So in the FreeBSD case you are looking for the SAT Layer (SATL). It
> could be in the FreeBSD CAM mid-level, the driver code or firmware,
> or in a remote device like a USB bridge. However if it was in something
> like a USB bridge then you would expect FreeBSD and Linux to react
> the same way. So it looks like a FreeBSD bug.
>
> Doug Gilbert
>
>
> Apologies for missing this thread until now.
>
> The SATL that is generating this fixed format sense data is in the isci driver
> itself. I think isci is returning the fixed format sense data correctly. My
> reading of the SPC spec is that fixed format sense data is 18 bytes + additional
> sense length, so if sense_data[7] == 0, then the sense data should indeed be 18
> bytes long.
Wrong. See spc4r37.pdf section 4.5.3 or any SCSI standard
back to SCSI-2. In table 53 — "Fixed format sense data" in
the byte 7 row is written: "ADDITIONAL SENSE LENGTH (n-7)".
For the typical (fixed format) sense data length of 18, n
will be 17 since the bytes count from 0. So byte 7 should
contain 10 (0xa in hex) to indicate an 18 byte sense data
buffer.
Thanks for identifying the isci as the culprit.
As a general rule in SCSI standards and drafts "additional
length" fields count starting from the byte following that
field. This is no exception, so the isci driver may be
making the same mistake elsewhere.
SAT-3 also indicates that for fixed format sense data for ATA
> PASSTHROUGH commands, there are no additional sense bytes - everything is
> returned in the INFORMATION and COMMAND-SPECIFIC INFORMATION bytes which are
> part of the first 18 bytes.
>
> I have looked a little at the smartctl code, and it does not look like it
> supports fixed format sense data - at least for ATA PASSTHROUGH. It expects
> additional sense length to be non-zero. smartctl could be fixed, but I think
> for compatibility, I should have isci return descriptor sense for ATA
> PASSTHROUGH commands instead.
>
> Martin - could you please test the attached patch? This passes your test case
> using smartctl 6.3 r3939.
Doug Gilbert
More information about the freebsd-scsi
mailing list