Repository navigation
Conversation
Make the code only change the Device Configuration Extension Mode Page (10h[01h]) to savable. And ignore other vendors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
This pull request includes the following changes or fixes.
mkltfsandltfsckfail onrelease/2.4.9.1with non-IBM drives (for example HP).10h[01h]) is changed.bool saveparameter to themodeselectbackend operation (struct tape_ops) and to every tape driver implementation.tape_set_pews()andtape_enable_append_only_mode(), setsavetotrueonly when the drive vendor isIBM_VENDOR_ID.modeselectcallers passsave = false.0x10 | (save ? 1 : 0)instead of the hardcoded0x11.#include <stdbool.h>tosg_tape.c.Description
Motivation and context
Since #652,
sg_modeselect()always setsPF=1andSP=1(cdb[1] = 0x11). This breaks non-IBM drives, because HP drive configuration pages are not savable. The reporter's HP Ultrium 6 returnsInvalid Field in CDB(05/2400,-20501) for the Mode Select. That breaks several operations:mkltfsLTFS17103E Cannot set PEWS, thenLTFS12053E Cannot format medium: backend call failed (-20500), thenLTFS15023I Formatting failedltfsckLTFS12031E Cannot set compression, thenLTFS16080E Cannot check volume (8)LTFS17155E Cannot set WRITE MODEThe reporter found that
mainand commits up to8518dac5work, and that #652 introduced the regression.What changes
The SP bit is now set only when both conditions hold:
saveargument. Onlytape_set_pews()andtape_enable_append_only_mode()do this.tape_get_info()matchesIBM_VENDOR_ID.Note
If
tape_get_info()fails,savablestaysfalse. Mode Select is then sent without SP, so the code fails safe.Implementation notes
save. The other drivers accept the parameter to match the interface and ignore it:src/libltfs/tape.cnow includestape_drivers/ibm_tape.hforIBM_VENDOR_ID.Verification
The reporter tested this patch on an HP Ultrium 6 drive on Fedora 45 (see #656):
ltfsck -m /dev/sg5completes withLTFS16022I Volume is consistent.ltfssucceeds and the file system is usable.Remaining non-fatal errors on the HP drive
05/2600(Invalid Field in Parameter List,EDEV_ILLEGAL_REQUEST,20500) when setting append-only mode. LTFS handles this and logsLTFS17266I Skip setting the append only mode because the drive doesn't seem to support it.05/2400because the HP drive doesn't support those pages.I have not yet tested on IBM drives.
Dependencies
None.
Fixes #656
Type of change
Checklist: