Skip to content
4 changes: 2 additions & 2 deletions messages/tape_iokit/root.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ root:table {
30804D:string { "CDB check condition: sense = %06x, %s." }
30805D:string { "CDB %s." }
30806I:string { "Unexpected CDB status: 0x%08x." }
30807D:string { "%s (0x%02x) expected error %d." }
30808I:string { "%s (0x%02x) returns %d." }
30807D:string { "%s (0x%02x) expected error %02x/%02x%02x (%d)." }
30808I:string { "%s (0x%02x) returns %02x/%02x%02x (%d)." }
30809I:string { "Cannot open device: inquiry failed (%d)." }
30810I:string { "Opening a device through iokit driver (%s)." }
30811I:string { "Cannot open device: failed to convert devname to devnumber (%s)." }
Expand Down
4 changes: 2 additions & 2 deletions messages/tape_linux_lin_tape/root.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ root:table {
30407D:string { "IOCTL: pos = 0x%02x%02x%02x%02x %s." }
30408I:string { "IOCTL: %s %d returns %d (generic %d) %s." }
30409D:string { "IOCTL: no sense info." }
30410D:string { "IOCTL: %s %d expected error %d." }
30411D:string { "IOCTL: %s %d expected error %d. retry the operation." }
30410D:string { "IOCTL: %s %d expected error %02x/%02x%02x (%d)." }
30411D:string { "IOCTL: %s %d expected error %02x/%02x%02x (%d). retry the operation." }
30412I:string { "Cannot get sense (%d)." }
30413I:string { "Error on %s: %s (%d) %s." }
30414E:string { "Error on %s: msg = NULL (%d) %s." }
Expand Down
4 changes: 2 additions & 2 deletions messages/tape_linux_sg/root.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ root:table {
30201D:string { "CDB check condition: sense = %06x, %s." }
30202D:string { "CDB %s." }
30203I:string { "CDB unexpected status: S = 0x%02x, M = 0x02%x" }
30204D:string { "%s (0x%02x) expected error %d." }
30205I:string { "%s (0x%02x) returns %d." }
30204D:string { "%s (0x%02x) expected error %02x/%02x%02x (%d)." }
30205I:string { "%s (0x%02x) returns %02x/%02x%02x (%d)." }
30206I:string { "Cannot open device: inquiry failed (%d)." }
30207I:string { "Vendor ID is %s." }
30208I:string { "Product ID is %s." }
Expand Down
7 changes: 7 additions & 0 deletions src/libltfs/arch/errormap.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ static struct error_map fuse_error_list[] = {
{ EDEV_TIMEOUT, "D1102E", ETIMEDOUT},
{ EDEV_ABORT_WAIT_READY, "D1103E", EIO},
{ EDEV_OVERFLOW, "D1300E", EIO},
{ EDEV_THIRD_PARTY_ERROR, "D1000E", EIO},
{ EDEV_UNREACHABLE_TARGET, "D1001E", EIO},
{ EDEV_INCORRECT_TARGET_TYPE, "D1002E", EIO},
{ EDEV_COPY_UNDERRUN, "D1003E", EIO},
{ EDEV_COPY_OVERRUN, "D1004E", EIO},
{ EDEV_INVALID_COPY, "D1005E", EIO},
{ EDEV_COPY_INFORMATION, "D1500E", EIO},
{ EDEV_CRYPTO_ERROR, "D1600E", EIO},
{ EDEV_KEY_SERVICE_ERROR, "D1601E", EIO},
{ EDEV_KEY_CHANGE_DETECTED, "D1602E", EIO},
Expand Down
22 changes: 21 additions & 1 deletion src/libltfs/ltfs_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
#define EDEV_DRIVE_NOT_PRESENT 20013 /* 00/8200 (TS3500) The drive is not present */
#define EDEV_RECORD_NOT_FOUND 20014 /* 00/1400 Record not found (string search) */
#define EDEV_INSUFFICIENT_TIME 20015 /* 00/2E00 Insufficient time for operation (string search) */
#define EDEV_IDLE 20016 /* 00/5E07 Idle condition activated by timer */
#define EDEV_CLEANING_REQUIRED 20098 /* (IBM LTO 00/8282) Drive requests cleaning */

/* Sense Key 1 Recovered Error */
Expand All @@ -361,10 +362,11 @@
#define EDEV_OPERATION_IN_PROGRESS 20205 /* 00/0016 02/0407 Operation in progress */
#define EDEV_OFFLINE 20206 /* 02/0412 Device is off-line */
#define EDEV_DOOR_OPEN 20207 /* 02/0418 Door Open*/
#define EDEV_OVER_TEMPERATURE 20208 /* 02/0B01 08/0B01 Device is too hot. */
#define EDEV_OVER_TEMPERATURE 20208 /* 02/0B01 0B/0B01 0B/0B0A 0B/0B0C Device is too hot. */
#define EDEV_NO_MEDIUM 20209 /* 02/3A00 Drive has no medium */
#define EDEV_NOT_SELF_CONFIGURED_YET 20210 /* 02/3E00 Device is not self configured yet */
#define EDEV_PARAMETER_VALUE_REJECTED 20211 /* 02/7411 SA creation parameter value rejected */
#define EDEV_OVER_HUMIDITY 20212 /* 02/0B0E 0B/0B0E 0B/0B10 Device humidity is too high */
#define EDEV_CLEANING_IN_PROGRESS 20297 /* 02/3003 Cleaning in progress*/
#define EDEV_IE_OPEN 20298 /* 02/0484 (TS3500) IO slot is opened */

Expand Down Expand Up @@ -422,6 +424,7 @@
#define EDEV_RESERVATION_PREEMPTED 20610 /* 06/2A03 Reservations preempted */
#define EDEV_RESERVATION_RELEASED 20611 /* 06/2A04 Reservations released */
#define EDEV_REGISTRATION_PREEMPTED 20612 /* 06/2A05 Registrations preempted */
#define EDEV_PREDICTION_FAILED 20613 /* 06/5D00 Failure prediction threshold exceeded */
#define EDEV_UA_MAX 20699 /* Minimum UA error value */
#define IS_UNIT_ATTENTION(e) ((e>=EDEV_UA_MIN)&&(e<=EDEV_UA_MAX))

Expand All @@ -441,15 +444,32 @@
#define EDEV_OVERLAPPED 21101 /* 0B/4E00 Overlapped commands */
#define EDEV_TIMEOUT 21102 /* 0B/4B06 Initiator response timeout */
#define EDEV_ABORT_WAIT_READY 21103 /* 0B/2907 0B/0800 0B/0801 on Library */
#define EDEV_MISCORRECTED_ERROR 21104 /* 0B/110A Miscorrected error */
#define EDEV_AUTH_FAILED 21105 /* 0B/7440 Authentication failed */

/* Sense Key D Volume Overflow */
#define EDEV_OVERFLOW 21300 /* 0D/XXXX The medium is overflowed */

/* Sense Key A Copy Aborted (3592 Only) */
#define EDEV_THIRD_PARTY_ERROR 21000 /* 0A/0D01 Third party device failure */
#define EDEV_UNREACHABLE_TARGET 21001 /* 0A/0D02 Copy target device not reachable */
#define EDEV_INCORRECT_TARGET_TYPE 21002 /* 0A/0D03 Incorrect copy target device type */
#define EDEV_COPY_UNDERRUN 21003 /* 0A/0D04 Copy target device data underrun */
#define EDEV_COPY_OVERRUN 21004 /* 0A/0D05 Copy target device data overrun */
#define EDEV_INVALID_COPY 21005 /* 0A/260C Invalid operation for copy source or destination */

/* Sense Key F Completed (3592 Only) */
#define EDEV_COPY_INFORMATION 21500 /* 0F/0020 Extended copy information available */

/* Crypto Errors on the tape drive */
#define EDEV_CRYPTO_ERROR 21600 /* XX/EEXX 07/EFXX 07/74XX Other crypto related errors */
#define EDEV_KEY_SERVICE_ERROR 21601 /* 04/EE0E 04/EE0F 07/EE0E 07/EE0F Key service timeout or failure */
#define EDEV_KEY_CHANGE_DETECTED 21602 /* 06/EE12 06/EE18 06/EE19 Detect key change */
#define EDEV_KEY_REQUIRED 21603 /* 07/EF10 Detect key change */
#define EDEV_KEY_GENERATION 21604 /* 07/EE11 07/EEA1 Detect key generation */
#define EDEV_KEY_TRANSLATE 21605 /* 07/EE13 Detect key translate */
#define EDEV_KEY_OPTIONAL 21606 /* 07/EE1A Detect key optional */
#define EDEV_NO_OPERATION 21607 /* 07/EEC0 Detect no operation */

/* Internal errors */
#define EDEV_INTERNAL_ERROR 21700 /* Internal logic error */
Expand Down
15 changes: 15 additions & 0 deletions src/tape_drivers/ibm_tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,26 @@ struct supported_device *usb_supported_drives[] = {
struct error_table ibm_tape_errors[] = {
/* Sense Key 0 (No Sense) */
{0x008282, -EDEV_CLEANING_REQUIRED, "IBM LTO - Cleaning Required"},

/* Sense Key 1 (Recoverd Error) */
{0x015DFF, -EDEV_RECOVERED_ERROR, "Failure Prediction Threshold Exceeded (FALSE)"},
{0x018252, -EDEV_DEGRADED_MEDIA, "IBM LTO - Degraded Media"},
{0x018383, -EDEV_RECOVERED_ERROR, "Drive Has Been Cleaned"},
{0x018500, -EDEV_RECOVERED_ERROR, "Search Match List Limit (warning)"},
{0x018501, -EDEV_RECOVERED_ERROR, "Search Snoop Match Found"},

/* Sense Key 3 (Medium Error) */
{0x038500, -EDEV_DATA_PROTECT, "Write Protected Because of Tape or Drive Failure"},
{0x038501, -EDEV_DATA_PROTECT, "Write Protected Because of Tape Failure"},
{0x038502, -EDEV_DATA_PROTECT, "Write Protected Because of Drive Failure"},


/* Sense Key 5 (Illegal Request) */
{0x058000, -EDEV_ILLEGAL_REQUEST, "CU Mode, Vendor-Unique"},
{0x058283, -EDEV_ILLEGAL_REQUEST, "Bad Microcode Detected"},
{0x058503, -EDEV_ILLEGAL_REQUEST, "Write Protected Because of Current Tape Position"},
{0x05A301, -EDEV_ILLEGAL_REQUEST, "OEM Vendor-Specific"},

/* Sense Key 6 (Unit Attention) */
{0x065DFF, -EDEV_UNIT_ATTENTION, "Failure Prediction False"},
{0x068283, -EDEV_UNIT_ATTENTION, "Drive Has Been Cleaned (older versions of microcode)"},
Expand All @@ -409,6 +415,7 @@ struct error_table ibm_tape_errors[] = {
{0x044781, -EDEV_HARDWARE_ERROR, "IBM LTO - Write Internal CRC Error"},
{0x04EE0E, -EDEV_KEY_SERVICE_ERROR, "Encryption - Key Service Timeout"}, /* LTO5, Jag4 and earlier */
{0x04EE0F, -EDEV_KEY_SERVICE_ERROR, "Encryption - Key Service Failure"}, /* LTO5, Jag4 and earlier */
{0x054080, -EDEV_ILLEGAL_REQUEST, "Recovered Diagnostic Failure"},
{0x05EE00, -EDEV_CRYPTO_ERROR, "Encryption - Key Service Not Enabled"},
{0x05EE01, -EDEV_CRYPTO_ERROR, "Encryption - Key Service Not Configured"},
{0x05EE02, -EDEV_CRYPTO_ERROR, "Encryption - Key Service Not Available"},
Expand Down Expand Up @@ -453,12 +460,20 @@ struct error_table ibm_tape_errors[] = {
{0x06EF1A, -EDEV_CRYPTO_ERROR, "Encryption - Key Optional (i.e., chose encryption enabled/disabled)"},
{0x07EE0E, -EDEV_KEY_SERVICE_ERROR, "Encryption - Key Service Timeout"}, /* LTO6, Jag5 and later */
{0x07EE0F, -EDEV_KEY_SERVICE_ERROR, "Encryption - Key Service Failure"}, /* LTO6, Jag5 and later */
{0x07EE10, -EDEV_KEY_REQUIRED, "Encryption - Key Required"},
{0x07EE11, -EDEV_KEY_GENERATION, "Encryption - Key Generation"},
{0x07EE13, -EDEV_KEY_TRANSLATE, "Encryption - Key Translate"},
{0x07EE1A, -EDEV_KEY_OPTIONAL, "Encryption - Key Optional"},
{0x07EEA0, -EDEV_KEY_REQUIRED, "Encryption - Key Required (T10)"},
{0x07EEA1, -EDEV_KEY_GENERATION, "Encryption - Key Generation (T10)"},
{0x07EEC0, -EDEV_NO_OPERATION, "Encryption - No Operation"},
{0x07EF10, -EDEV_KEY_REQUIRED, "Encryption - Key Required"},
{0x07EF11, -EDEV_CRYPTO_ERROR, "Encryption - Key Generation"},
{0x07EF13, -EDEV_CRYPTO_ERROR, "Encryption - Key Translate"},
{0x07EF1A, -EDEV_CRYPTO_ERROR, "Encryption - Key Optional"},
{0x07EF31, -EDEV_CRYPTO_ERROR, "Encryption - Key Unknown"},
{0x07EFC0, -EDEV_CRYPTO_ERROR, "Encryption - No Operation"},
/* NOTE: entries with ASC < 0x80 and ASCQ < 0x80 have been moved to standard_tape_errors */
/* END MARK*/
{0xFFFFFF, -EDEV_UNKNOWN, "Unknown Error code"},
};
Expand Down
6 changes: 4 additions & 2 deletions src/tape_drivers/linux/lin_tape/lin_tape_ibmtape.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,14 @@ static inline int _sioc_stioc_command(void *device, int cmd, char *cmd_name, voi
rc = lin_tape_ibmtape_ioctlrc2err(device, fd, &sense_data, msg);

if (rc == -EDEV_TIME_STAMP_CHANGED) {
ltfsmsg(LTFS_DEBUG, 30411D, cmd_name, cmd, rc);
ltfsmsg(LTFS_DEBUG, 30411D, cmd_name, cmd,
sense_data.key, sense_data.asc, sense_data.ascq, rc);
goto start;
}

if (is_expected_error(cmd, param, rc)) {
ltfsmsg(LTFS_DEBUG, 30410D, cmd_name, cmd, rc);
ltfsmsg(LTFS_DEBUG, 30410D, cmd_name, cmd,
sense_data.key, sense_data.asc, sense_data.ascq, rc);
}
else {
ltfsmsg(LTFS_INFO, 30408I, cmd_name, cmd, rc, errno, ((struct lin_tape_ibmtape *) device)->drive_serial);
Expand Down
6 changes: 4 additions & 2 deletions src/tape_drivers/linux/sg/sg_scsi_tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,11 @@ int sg_issue_cdb_command(struct sg_tape *device, sg_io_hdr_t *req, char **msg)

if (ret != DEVICE_GOOD) {
if (is_expected_error(device, req->cmdp, ret)) {
ltfsmsg(LTFS_DEBUG, 30204D, (char *)req->usr_ptr, req->cmdp[0], ret);
ltfsmsg(LTFS_DEBUG, 30204D, (char *)req->usr_ptr, req->cmdp[0],
(sense >> 16) & 0xFF, (sense >> 8) & 0xFF, sense & 0xFF, ret);
} else {
ltfsmsg(LTFS_INFO, 30205I, (char *)req->usr_ptr, req->cmdp[0], ret);
ltfsmsg(LTFS_INFO, 30205I, (char *)req->usr_ptr, req->cmdp[0],
(sense >> 16) & 0xFF, (sense >> 8) & 0xFF, sense & 0xFF, ret);
}
}

Expand Down
14 changes: 9 additions & 5 deletions src/tape_drivers/netbsd/scsipi-ibmtape/scsipi_scsi_tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ int scsipi_issue_cdb_command(struct scsipi_tape *device, scsireq_t *req,
{
int status = 0;
int ret = -1;
uint32_t sense = 0;

CHECK_ARG_NULL(req, -LTFS_NULL_ARG);
CHECK_ARG_NULL(msg, -LTFS_NULL_ARG);
Expand Down Expand Up @@ -233,7 +234,6 @@ int scsipi_issue_cdb_command(struct scsipi_tape *device, scsireq_t *req,

if (req->retsts == SCCMD_SENSE) {
if (req->senselen_used) {
uint32_t sense = 0;
ret = scsipi_sense2errno(req, &sense, msg);
ltfsmsg(LTFS_DEBUG, 30201D, sense, *msg);
} else {
Expand All @@ -242,10 +242,14 @@ int scsipi_issue_cdb_command(struct scsipi_tape *device, scsireq_t *req,
}
}

if (is_expected_error(device, req->cmd, ret)) {
ltfsmsg(LTFS_DEBUG, 30204D, desc, req->cmd[0], ret);
} else {
ltfsmsg(LTFS_INFO, 30205I, desc, req->cmd[0], ret);
if (ret != DEVICE_GOOD) {
if (is_expected_error(device, req->cmd, ret)) {
ltfsmsg(LTFS_DEBUG, 30204D, desc, req->cmd[0],
(sense >> 16) & 0xFF, (sense >> 8) & 0xFF, sense & 0xFF, ret);
} else {
ltfsmsg(LTFS_INFO, 30205I, desc, req->cmd[0],
(sense >> 16) & 0xFF, (sense >> 8) & 0xFF, sense & 0xFF, ret);
}
}

out:
Expand Down
6 changes: 4 additions & 2 deletions src/tape_drivers/osx/iokit/iokit_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,11 @@ int iokit_issue_cdb_command(struct iokit_device *device,
free:
if (ret != DEVICE_GOOD) {
if (is_expected_error(device, req->cmdp, ret)) {
ltfsmsg(LTFS_DEBUG, 30807D, req->desc, req->cmdp[0], ret);
ltfsmsg(LTFS_DEBUG, 30807D, req->desc, req->cmdp[0],
(sense >> 16) & 0xFF, (sense >> 8) & 0xFF, sense & 0xFF, ret);
} else {
ltfsmsg(LTFS_INFO, 30808I, req->desc, req->cmdp[0], ret);
ltfsmsg(LTFS_INFO, 30808I, req->desc, req->cmdp[0],
(sense >> 16) & 0xFF, (sense >> 8) & 0xFF, sense & 0xFF, ret);
}
}

Expand Down
Loading
Loading