pbs-tape: sgutils2: check sense data when status is 'CHECK_CONDITION'
Some raid controllers return a 'transport error' when we expected a 'sense error'. it seems the correct way to check the sense data is when either the result category is 'SENSE' or when the status is 'CHECK_CONDITION', so do that. (similar to how 'sg_raw' returns the errors) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
6da20161f0
commit
eb1cd24e21
|
@ -141,6 +141,9 @@ pub const SENSE_KEY_ABORTED_COMMAND: u8 = 0x0b;
|
||||||
pub const SENSE_KEY_VOLUME_OVERFLOW: u8 = 0x0d;
|
pub const SENSE_KEY_VOLUME_OVERFLOW: u8 = 0x0d;
|
||||||
pub const SENSE_KEY_MISCOMPARE: u8 = 0x0e;
|
pub const SENSE_KEY_MISCOMPARE: u8 = 0x0e;
|
||||||
|
|
||||||
|
// SAM STAT
|
||||||
|
const SAM_STAT_CHECK_CONDITION: i32 = 0x02;
|
||||||
|
|
||||||
/// Sense Key Descriptions
|
/// Sense Key Descriptions
|
||||||
pub const SENSE_KEY_DESCRIPTIONS: [&str; 16] = [
|
pub const SENSE_KEY_DESCRIPTIONS: [&str; 16] = [
|
||||||
"No Sense",
|
"No Sense",
|
||||||
|
@ -457,11 +460,16 @@ impl<'a, F: AsRawFd> SgRaw<'a, F> {
|
||||||
|
|
||||||
let sense_len = unsafe { get_scsi_pt_sense_len(ptvp.as_ptr()) };
|
let sense_len = unsafe { get_scsi_pt_sense_len(ptvp.as_ptr()) };
|
||||||
|
|
||||||
let res_cat = unsafe { get_scsi_pt_result_category(ptvp.as_ptr()) };
|
let mut res_cat = unsafe { get_scsi_pt_result_category(ptvp.as_ptr()) };
|
||||||
|
let status = unsafe { get_scsi_pt_status_response(ptvp.as_ptr()) };
|
||||||
|
|
||||||
|
if res_cat == SCSI_PT_RESULT_TRANSPORT_ERR && status == SAM_STAT_CHECK_CONDITION {
|
||||||
|
res_cat = SCSI_PT_RESULT_SENSE;
|
||||||
|
}
|
||||||
|
|
||||||
match res_cat {
|
match res_cat {
|
||||||
SCSI_PT_RESULT_GOOD => Ok(()),
|
SCSI_PT_RESULT_GOOD => Ok(()),
|
||||||
SCSI_PT_RESULT_STATUS => {
|
SCSI_PT_RESULT_STATUS => {
|
||||||
let status = unsafe { get_scsi_pt_status_response(ptvp.as_ptr()) };
|
|
||||||
if status != 0 {
|
if status != 0 {
|
||||||
return Err(
|
return Err(
|
||||||
format_err!("unknown scsi error - status response {}", status).into(),
|
format_err!("unknown scsi error - status response {}", status).into(),
|
||||||
|
|
Loading…
Reference in New Issue