Skip to content

fix: Drive Sense Key error#625

Open
Rolaxgar97 wants to merge 8 commits into
LinearTapeFileSystem:release/v2.4.9.0from
vandelvan:update/sense-keys
Open

fix: Drive Sense Key error#625
Rolaxgar97 wants to merge 8 commits into
LinearTapeFileSystem:release/v2.4.9.0from
vandelvan:update/sense-keys

Conversation

@Rolaxgar97

Copy link
Copy Markdown

Summary of changes

This pull request includes following changes or fixes.

  • Sense key updates: removed invalid sense keys from the ltfs_error and ibm_tape sense key table and added the correct ones.
  • Logic to print the corresponding sense key error instead of an undefined magic number

Description

This pull request updates the sense key handling to improve error reporting and ensure the correct sense key information is displayed.

  • Updated the ltfs_error and ibm_tape sense key tables by removing invalid entries and adding the correct sense key definitions.
  • Added logic to print the corresponding sense key error message instead of an undefined magic number.
  • Improved sense key mapping consistency across error handling components.

Type of change

Please delete items that are not relevant.

  • Refactoring
  • This change requires a documentation update (TBC)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have confirmed my fix is effective or that my feature works

@Rolaxgar97 Rolaxgar97 self-assigned this Jul 22, 2026
@vandelvan vandelvan self-assigned this Jul 22, 2026
@vandelvan
vandelvan changed the base branch from main to release/v2.4.9.0 July 22, 2026 16:57
@Piloalucard

Copy link
Copy Markdown
Member

Hello! Thank you for this effort. Do you have logs documented to show how the sense key is being printed now? I am curious to see how it works.
Aside from that, do you have the SCSI Reference version that you used to update the sense keys? I would like to confirm the differences.

@Rolaxgar97

Copy link
Copy Markdown
Author

Hi @Piloalucard
Using a test script, we forced the generation of sense keys, producing the following logs:

==========================================================
LTFS Sense Key Regression Test (via LD_PRELOAD injection)
Started:     
Device:       -
LTFS binary:  -
Shim:         -
Results log: -
==========================================================

Legend:
  PASS        – LTFS recognized the sense code and logged the correct message
  FAIL        – regression: code missing from tables or wrong message
  KNOWN_ISSUE – code present in ibm_tape_errors but unreachable (see below)

  PASS  [008282] SK0/8282 Cleaning Required (IBM)
        → 20f941 LTFS30201D CDB check condition: sense = 008282, IBM LTO - Cleaning Required.
  PASS  [00EE13] SK0/EE13 Encryption Key translate
        → 20fa3e LTFS30201D CDB check condition: sense = 00ee13, Encryption - Key translate.
  PASS  [015DFF] SK1/5DFF Failure Prediction FALSE
        → 20fb0b LTFS30201D CDB check condition: sense = 015dff, Failure Prediction Threshold Exceeded (FALSE).
  PASS  [018383] SK1/8383 Drive Has Been Cleaned
        → 20fcfc LTFS30201D CDB check condition: sense = 018383, Drive Has Been Cleaned.
  PASS  [018500] SK1/8500 Search Match List Limit
        → 210246 LTFS30201D CDB check condition: sense = 018500, Search Match List Limit (warning).
  PASS  [018501] SK1/8501 Search Snoop Match Found
        → 21041e LTFS30201D CDB check condition: sense = 018501, Search Snoop Match Found.
  PASS  [018252] SK1/8252 Degraded Media
        → 21049e LTFS30201D CDB check condition: sense = 018252, IBM LTO - Degraded Media.
  PASS  [038500] SK3/8500 Write Prot Tape/Drive
        → 21053b LTFS30201D CDB check condition: sense = 038500, Write Protected Because of Tape or Drive Failure.
  PASS  [038501] SK3/8501 Write Prot Tape
        → 21066a LTFS30201D CDB check condition: sense = 038501, Write Protected Because of Tape Failure.
  PASS  [038502] SK3/8502 Write Prot Drive
        → 21070c LTFS30201D CDB check condition: sense = 038502, Write Protected Because of Drive Failure.
  PASS  [058000] SK5/8000 CU Mode Vendor Unique
        → 2108cc LTFS30201D CDB check condition: sense = 058000, CU Mode, Vendor-Unique.
  PASS  [058283] SK5/8283 Bad Microcode
        → 210a9b LTFS30201D CDB check condition: sense = 058283, Bad Microcode Detected.
  PASS  [058503] SK5/8503 Write Prot Tape Position
        → 21106b LTFS30201D CDB check condition: sense = 058503, Write Protected Because of Current Tape Position.
  PASS  [05A301] SK5/A301 OEM Vendor Specific
        → 21111e LTFS30201D CDB check condition: sense = 05a301, OEM Vendor-Specific.
  PASS  [065DFF] SK6/5DFF Failure Prediction False UA
        → 2111aa LTFS30201D CDB check condition: sense = 065dff, Failure Prediction False.
  PASS  [068283] SK6/8283 Drive Cleaned Older FW
        → 21125d LTFS30201D CDB check condition: sense = 068283, Drive Has Been Cleaned (older versions of microcode).
  PASS  [068500] SK6/8500 Search Match List Limit Alert
        → 211386 LTFS30201D CDB check condition: sense = 068500, Search Match List Limit (alert).
  PASS  [03EE60] SK3/EE60 Encryption Proxy Cmd
        → 211567 LTFS30201D CDB check condition: sense = 03ee60, Encryption - Proxy Command Error.
  PASS  [03EED0] SK3/EED0 Data Read Decryption
        → 2115db LTFS30201D CDB check condition: sense = 03eed0, Encryption - Data Read Decryption Failure.
  PASS  [03EED1] SK3/EED1 Data Read After Write
        → 211b52 LTFS30201D CDB check condition: sense = 03eed1, Encryption - Data Read after Write Decryption Failure.
  PASS  [03EEE0] SK3/EEE0 Key Translation Failure
        → 211d1b LTFS30201D CDB check condition: sense = 03eee0, Encryption - Key Translation Failure.
  PASS  [03EEE1] SK3/EEE1 Key Translation Ambiguous
        → 211db8 LTFS30201D CDB check condition: sense = 03eee1, Encryption - Key Translation Ambiguous.
  PASS  [03EEF0] SK3/EEF0 Decryption Fenced Read
        → 211e3c LTFS30201D CDB check condition: sense = 03eef0, Encryption - Decryption Fenced (Read).
  PASS  [03EEF1] SK3/EEF1 Encryption Fenced Write
        → 211f6f LTFS30201D CDB check condition: sense = 03eef1, Encryption - Encryption Fenced (Write).
  PASS  [044780] SK4/4780 Read Internal CRC
        → 2121c4 LTFS30201D CDB check condition: sense = 044780, IBM LTO - Read Internal CRC Error.
  PASS  [044781] SK4/4781 Write Internal CRC
        → 212277 LTFS30201D CDB check condition: sense = 044781, IBM LTO - Write Internal CRC Error.
  PASS  [04EE0E] SK4/EE0E Key Service Timeout
        → 21233d LTFS30201D CDB check condition: sense = 04ee0e, Encryption - Key Service Timeout.
  PASS  [04EE0F] SK4/EE0F Key Service Failure
        → 21296d LTFS30201D CDB check condition: sense = 04ee0f, Encryption - Key Service Failure.
  PASS  [054080] SK5/4080 Recovered Diagnostic
        → 212a1b LTFS30201D CDB check condition: sense = 054080, Recovered Diagnostic Failure.
  PASS  [07EE0E] SK7/EE0E Key Service Timeout
        → 212ac7 LTFS30201D CDB check condition: sense = 07ee0e, Encryption - Key Service Timeout.
  PASS  [07EE0F] SK7/EE0F Key Service Failure
        → 212b3d LTFS30201D CDB check condition: sense = 07ee0f, Encryption - Key Service Failure.
  PASS  [07EE10] SK7/EE10 Key Required
        → 2131e2 LTFS30201D CDB check condition: sense = 07ee10, Encryption - Key Required.
  PASS  [07EE11] SK7/EE11 Key Generation
        → 21328f LTFS30201D CDB check condition: sense = 07ee11, Encryption - Key Generation.
  PASS  [07EE13] SK7/EE13 Key Translate
        → 21332e LTFS30201D CDB check condition: sense = 07ee13, Encryption - Key Translate.
  PASS  [07EE1A] SK7/EE1A Key Optional
        → 213475 LTFS30201D CDB check condition: sense = 07ee1a, Encryption - Key Optional.
  PASS  [07EEA0] SK7/EEA0 Key Required T10
        → 2139bb LTFS30201D CDB check condition: sense = 07eea0, Encryption - Key Required (T10).
  PASS  [07EEA1] SK7/EEA1 Key Generation T10
        → 213a50 LTFS30201D CDB check condition: sense = 07eea1, Encryption - Key Generation (T10).
  PASS  [07EEC0] SK7/EEC0 No Operation
        → 213af1 LTFS30201D CDB check condition: sense = 07eec0, Encryption - No Operation.
  PASS  [035200] SK3/5200 Cartridge/Media Load (KNOWN_ISSUE)
        → 213d30 LTFS30201D CDB check condition: sense = 035200, (LTO)Cartridge Fault/(3592)Media Load or Eject Failed.
  PASS  [055506] SK5/5506 Aux Memory 3592 (KNOWN_ISSUE)
        → 213e90 LTFS30201D CDB check condition: sense = 055506, Auxiliary Memory Out of Space.
  PASS  [062A0D] SK6/2A0D Encryption Caps Changed (KNOWN_ISSUE)
        → 213f29 LTFS30201D CDB check condition: sense = 062a0d, Data Encryption Capabilities Changed.
  PASS  [0A0D01] SKA/0D01 Third Party Device (KNOWN_ISSUE)
        → 213fbd LTFS30201D CDB check condition: sense = 0a0d01, Third Party Device Failure.
  PASS  [0A0D02] SKA/0D02 Copy Target Unreachable (KNOWN_ISSUE)
        → 214445 LTFS30201D CDB check condition: sense = 0a0d02, Copy Target Device Not Reachable.
  PASS  [0A0D03] SKA/0D03 Incorrect Target Type (KNOWN_ISSUE)
        → 2146dc LTFS30201D CDB check condition: sense = 0a0d03, Incorrect Copy Target Device Type.
  PASS  [0A0D04] SKA/0D04 Copy Underrun (KNOWN_ISSUE)
        → 21475a LTFS30201D CDB check condition: sense = 0a0d04, Copy Target Device Data Underrun.
  PASS  [0A0D05] SKA/0D05 Copy Overrun (KNOWN_ISSUE)
        → 21494f LTFS30201D CDB check condition: sense = 0a0d05, Copy Target Device Data Overrun.
  PASS  [0A260C] SKA/260C Invalid Copy Op (KNOWN_ISSUE)
        → 2149f6 LTFS30201D CDB check condition: sense = 0a260c, Invalid Operation for Copy Source or Destination.
  PASS  [0A2F02] SKA/2F02 Commands Cleared (KNOWN_ISSUE)
        → 214b0d LTFS30201D CDB check condition: sense = 0a2f02, Commands Cleared by Device Server.
  PASS  [0F0020] SKF/0020 Extended Copy Info (KNOWN_ISSUE)
        → 214b8f LTFS30201D CDB check condition: sense = 0f0020, Extended Copy Information Available.

==========================================================
Results: 49 passed, 0 failed, 0 known issues
==========================================================

struct error_table ibm_tape_errors[] = {
/* Sense Key 0 (No Sense) */
{0x008282, -EDEV_CLEANING_REQUIRED, "IBM LTO - Cleaning Required"},
{0x00EE13, -EDEV_RECOVERED_ERROR, "Encryption - Key translate"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be EF 13

@Piloalucard Piloalucard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This is an update really needed, I just notice a wrong HEX code, besides that, LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants