hostbyte=DID_XXX driverbyte=DRIVER_XXXX 錯誤查詢

現象舉例

1. hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OKlinux

  
    
  
  
  
   
   
            
   
   
  1. web

  2. 微信

Jul 16 08:06:53 localhost kernel: sd 11:0:0:0: [sdh] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OKJul 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_SENSEapp

  
    
  
  
  
   
   
            
   
   
  1. ide

  2. flex

[ 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_OKthis

  
    
  
  
  
   
   
            
   
   
  1. spa

  2. .net

Dec 6 18:12:13 localhost kernel: sd 20:0:0:0: [sdb] FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OKDec 6 18:12:13 localhost kernel: blk_update_request: I/O error, dev sdb, sector 512

hostbyte和driverbyte

定義

linux/include/scsi/scsi.hcode

  
    
  
  
  
   
   
            
   
   
/* * 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

  
    
  
  
  
   
   
            
   
   







....../* * 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




本文分享自微信公衆號 - WriteSimpleDemo(this_is_a_wechat)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。

相關文章
相關標籤/搜索