[pbs-devel] [PATCH proxmox-backup v2] tape: work around buggy changer implementations

Dominik Csapak d.csapak at proxmox.com
Wed Dec 13 10:00:26 CET 2023


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 at proxmox.com>
---
changes from v1:
* add a comment to make sure we know why we set this value
 pbs-tape/src/sg_pt_changer.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pbs-tape/src/sg_pt_changer.rs b/pbs-tape/src/sg_pt_changer.rs
index cfddbf9a..5b8596f0 100644
--- a/pbs-tape/src/sg_pt_changer.rs
+++ b/pbs-tape/src/sg_pt_changer.rs
@@ -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);
-- 
2.30.2





More information about the pbs-devel mailing list