前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >hostbyte=DID_XXX driverbyte=DRIVER_XXXX 错误查询

hostbyte=DID_XXX driverbyte=DRIVER_XXXX 错误查询

作者头像
PedroQin
发布2020-02-12 11:03:37
8K0
发布2020-02-12 11:03:37
举报
文章被收录于专栏:WriteSimpleDemoWriteSimpleDemo

现象举例

1. hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK

代码语言:javascript
复制
Jul 16 08:06:53 localhost kernel: sd 11:0:0:0: [sdh] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
Jul 16 08:06:53 localhost kernel: sd 11:0:0:0: [sdh] Start/Stop Unit failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK

2. hostbyte=DID_OK driverbyte=DRIVER_SENSE

代码语言:javascript
复制
[   37.404796] sd 0:0:0:0: [sda] tag#3 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[   37.404806] blk_update_request: I/O error, dev sda, sector 0

3. hostbyte=DID_ERROR driverbyte=DRIVER_OK

代码语言:javascript
复制
Dec  6 18:12:13 localhost kernel: sd 20:0:0:0: [sdb] FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
Dec  6 18:12:13 localhost kernel: blk_update_request: I/O error, dev sdb, sector 512

hostbyte和driverbyte

定义

linux/include/scsi/scsi.h

代码语言:javascript
复制
/*
 *  Use these to separate status msg and our bytes
 *
 *  These are set by:
 *
 *      status byte = set from target device
 *      msg_byte    = return status from host adapter itself.
 *      host_byte   = set by low-level driver to indicate status.
 *      driver_byte = set by mid-level.
 */
#define status_byte(result) (((result) >> 1) & 0x7f)
#define msg_byte(result)    (((result) >> 8) & 0xff)
#define host_byte(result)   (((result) >> 16) & 0xff)
#define driver_byte(result) (((result) >> 24) & 0xff)

hostbyte

hostbyte

符号(Symbol)

含义

0x00

DID_OK

没有错误

0x01

DID_NO_CONNECT

在超时之前,不能连接

0x02

DID_BUS_BUSY

在超时期间,BUS一直处于忙状态

0x03

DID_TIME_OUT

因为其他原因超时

0x04

DID_BAD_TARGET

BAD target

0x05

DID_ABORT

因为其他原因取消

0x06

DID_PARITY

Parity错误

0x07

DID_ERROR

内部错误(internal error)

0x08

DID_RESET

被复位

0x09

DID_BAD_INTR

得到一个未被期望的中断

driverbyte

driverbyte

符号(Symbol)

含义

0x00

DRIVER_OK

没有错误

0x01

DRIVER_BUSY

-

0x02

DRIVER_SOFT

-

0x03

DRIVER_MEDIA

-

0x04

DRIVER_ERROR

内部驱动错误

0x05

DRIVER_INVALID

完成(DIDBADTARGET或DID_ABORT)

0x06

DRIVER_TIMEOUT

超时完成

0x07

DRIVER_HARD

完成,但有致命错误

0x08

DRIVER_SENSE

有sense信息

0x10

SUGGEST_RETRY

重试SCSI请求

0x20

SUGGEST_ABORT

取消请求

0x30

SUGGEST_REMAP

重新映射block,但没有完成

0x40

SUGGEST_DIE

让内核Panic

0x80

SUGGEST_SENSE

从设备上获取Sense信息

0xff

SUGGESTISOK

不需要做任何操作

附录

source code

file: linux/include/scsi/scsi.h

代码语言:javascript
复制
......

/*
 * Host byte codes
 */

#define DID_OK          0x00    /* NO error                                */
#define DID_NO_CONNECT  0x01    /* Couldn't connect before timeout period  */
#define DID_BUS_BUSY    0x02    /* BUS stayed busy through time out period */
#define DID_TIME_OUT    0x03    /* TIMED OUT for other reason              */
#define DID_BAD_TARGET  0x04    /* BAD target.                             */
#define DID_ABORT       0x05    /* Told to abort for some other reason     */
#define DID_PARITY      0x06    /* Parity error                            */
#define DID_ERROR       0x07    /* Internal error                          */
#define DID_RESET       0x08    /* Reset by somebody.                      */
#define DID_BAD_INTR    0x09    /* Got an interrupt we weren't expecting.  */
#define DID_PASSTHROUGH 0x0a    /* Force command past mid-layer            */
#define DID_SOFT_ERROR  0x0b    /* The low level driver just wish a retry  */
#define DID_IMM_RETRY   0x0c    /* Retry without decrementing retry count  */
#define DID_REQUEUE    0x0d    /* Requeue command (no immediate retry) also
                 * without decrementing the retry count    */
#define DID_TRANSPORT_DISRUPTED 0x0e /* Transport error disrupted execution
                      * and the driver blocked the port to
                      * recover the link. Transport class will
                      * retry or fail IO */
#define DID_TRANSPORT_FAILFAST    0x0f /* Transport class fastfailed the io */
#define DID_TARGET_FAILURE 0x10 /* Permanent target failure, do not retry on
                 * other paths */
#define DID_NEXUS_FAILURE 0x11  /* Permanent nexus failure, retry on other
                 * paths might yield different results */
#define DID_ALLOC_FAILURE 0x12  /* Space allocation on the device failed */
#define DID_MEDIUM_ERROR  0x13  /* Medium error */
#define DRIVER_OK       0x00    /* Driver status                           */

/*
 *  These indicate the error that occurred, and what is available.
 */

#define DRIVER_BUSY         0x01
#define DRIVER_SOFT         0x02
#define DRIVER_MEDIA        0x03
#define DRIVER_ERROR        0x04

#define DRIVER_INVALID      0x05
#define DRIVER_TIMEOUT      0x06
#define DRIVER_HARD         0x07
#define DRIVER_SENSE        0x08

......
/*
 *  Use these to separate status msg and our bytes
 *
 *  These are set by:
 *
 *      status byte = set from target device
 *      msg_byte    = return status from host adapter itself.
 *      host_byte   = set by low-level driver to indicate status.
 *      driver_byte = set by mid-level.
 */
#define status_byte(result) (((result) >> 1) & 0x7f)
#define msg_byte(result)    (((result) >> 8) & 0xff)
#define host_byte(result)   (((result) >> 16) & 0xff)
#define driver_byte(result) (((result) >> 24) & 0xff)

#define sense_class(sense)  (((sense) >> 4) & 0x7)
#define sense_error(sense)  ((sense) & 0xf)
#define sense_valid(sense)  ((sense) & 0x80)
......

SCSI SENSE

A SCSI sense buffer is the error reporting facility in SCSI. It reports the error code and possibly also additional information that helps to locate thesource of the problem so the administrator or developer can help resolve the issue.

A SCSI sense has several top-level attributes that one would care about the most:

  • Sense type, either fixed or descriptor,
  • What command it relates to, current or previous,
  • Sense Key,
  • ASC/ASCQ — Additional Sense Code and Additional Sense Code Qualifier.

The easiest way to decode a sense buffer is to use a tool, I know of two:

  • sg3utils provides sgdecode_sense since version 1.31
  • libscsicmd implements it
  • a web tool is available to Decode the sense data that is based on libscsicmd

参考链接

Linux内核I/O报错信息中hostbyte与driverbyte含义(http://ilinuxkernel.com/?p=760) /usr/src/kernels/3.10.0-957.el7.x86_64/include/scsi/scsi.h

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-01-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WriteSimpleDemo 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 现象举例
  • hostbyte和driverbyte
    • 定义
      • hostbyte
        • driverbyte
        • 附录
          • source code
            • SCSI SENSE
              • 参考链接
              相关产品与服务
              流计算 Oceanus
              流计算 Oceanus 是大数据产品生态体系的实时化分析利器,是基于 Apache Flink 构建的企业级实时大数据分析平台,具备一站开发、无缝连接、亚秒延时、低廉成本、安全稳定等特点。流计算 Oceanus 以实现企业数据价值最大化为目标,加速企业实时化数字化的建设进程。
              领券
              问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档