tape: work around buggy changer implementations

allocation length for read element status is a 3 byte field, but it
seems some changers only look at the bottom two bytes. Since we used
0x010000 for it, those changers did not return any data and the calls
failed.

To work around it, request one byte less (0xFFFF) which should still be
enough for the data, but should now work with those buggy
implementations.

Reported by a user in the forum: https://forum.proxmox.com/threads/137391/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2023-12-13 10:00:26 +01:00 committed by Dietmar Maurer
parent fee9454998
commit d3b934d405

View File

@ -369,7 +369,7 @@ pub fn read_element_status<F: AsRawFd>(file: &mut F) -> Result<MtxStatus, Error>
// first, request address assignment (used for sanity checks)
let setup = read_element_address_assignment(file)?;
let allocation_len: u32 = 0x10000;
let allocation_len: u32 = 0xFFFF; // some changer only use the lower 2 bytes
let mut sg_raw = SgRaw::new(file, allocation_len as usize)?;
sg_raw.set_timeout(SCSI_CHANGER_DEFAULT_TIMEOUT);