public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2] tape: work around buggy changer implementations
@ 2023-12-13  9:00 Dominik Csapak
  2023-12-14  8:39 ` Dominik Csapak
  2023-12-22  8:15 ` [pbs-devel] applied: " Dietmar Maurer
  0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2023-12-13  9:00 UTC (permalink / raw)
  To: pbs-devel

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>
---
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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup v2] tape: work around buggy changer implementations
  2023-12-13  9:00 [pbs-devel] [PATCH proxmox-backup v2] tape: work around buggy changer implementations Dominik Csapak
@ 2023-12-14  8:39 ` Dominik Csapak
  2023-12-22  8:15 ` [pbs-devel] applied: " Dietmar Maurer
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2023-12-14  8:39 UTC (permalink / raw)
  To: pbs-devel

just to note, the user in the forum confirmed that this patch
works such that they can now list the changer status
(while before they could not at all)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup v2] tape: work around buggy changer implementations
  2023-12-13  9:00 [pbs-devel] [PATCH proxmox-backup v2] tape: work around buggy changer implementations Dominik Csapak
  2023-12-14  8:39 ` Dominik Csapak
@ 2023-12-22  8:15 ` Dietmar Maurer
  1 sibling, 0 replies; 3+ messages in thread
From: Dietmar Maurer @ 2023-12-22  8:15 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

applied

On 12/13/23 10:00, Dominik Csapak wrote:
> 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>
> ---
> 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);




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-22  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-13  9:00 [pbs-devel] [PATCH proxmox-backup v2] tape: work around buggy changer implementations Dominik Csapak
2023-12-14  8:39 ` Dominik Csapak
2023-12-22  8:15 ` [pbs-devel] applied: " Dietmar Maurer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal