public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] tape: fix encryption on certain tape drives
@ 2025-12-15 13:59 Dominik Csapak
  2025-12-16  8:10 ` [pbs-devel] applied: " Dietmar Maurer
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-12-15 13:59 UTC (permalink / raw)
  To: pbs-devel

For most SCSI commands, we have to preallocate a buffer for sg_utils to
write into, and the SCSI commands get the buffer size as parameter so
that the tape know how much data it can send.

It seems that some tape drives only allow aligned buffer sizes, though
it's not clear if it has to aligned to 512 or 4096 bytes.

In case of the tape encryption pages, we used 8192 + 4 bytes for some
reason, which tripped those tape drives up and they returned an error
instead of valid data.

Every other instance of our commands use aligned buffer sizes, so use
them here too to increase compatibility.

Tested on our LTO9 tape changer, which works with both values correctly.

This was encountered by a customer in an enterprise ticket.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 pbs-tape/src/sg_tape/encryption.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pbs-tape/src/sg_tape/encryption.rs b/pbs-tape/src/sg_tape/encryption.rs
index c24a6c658..9390dff7d 100644
--- a/pbs-tape/src/sg_tape/encryption.rs
+++ b/pbs-tape/src/sg_tape/encryption.rs
@@ -134,7 +134,7 @@ fn sg_spout_set_encryption<F: AsRawFd>(
 // Warning: this blocks and fails if there is no media loaded
 #[allow(clippy::vec_init_then_push)]
 fn sg_spin_data_encryption_status<F: AsRawFd>(file: &mut F) -> Result<Vec<u8>, Error> {
-    let allocation_len: u32 = 8192 + 4;
+    let allocation_len: u32 = 8192;
 
     let mut sg_raw = SgRaw::new(file, allocation_len as usize)?;
 
@@ -163,7 +163,7 @@ fn sg_spin_data_encryption_status<F: AsRawFd>(file: &mut F) -> Result<Vec<u8>, E
 // Warning: this blocks and fails if there is no media loaded
 #[allow(clippy::vec_init_then_push)]
 fn sg_spin_data_encryption_caps<F: AsRawFd>(file: &mut F) -> Result<Vec<u8>, Error> {
-    let allocation_len: u32 = 8192 + 4;
+    let allocation_len: u32 = 8192;
 
     let mut sg_raw = SgRaw::new(file, allocation_len as usize)?;
 
-- 
2.47.3



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* [pbs-devel] applied: [PATCH proxmox-backup] tape: fix encryption on certain tape drives
  2025-12-15 13:59 [pbs-devel] [PATCH proxmox-backup] tape: fix encryption on certain tape drives Dominik Csapak
@ 2025-12-16  8:10 ` Dietmar Maurer
  0 siblings, 0 replies; 2+ messages in thread
From: Dietmar Maurer @ 2025-12-16  8:10 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

applied


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-15 13:59 [pbs-devel] [PATCH proxmox-backup] tape: fix encryption on certain tape drives Dominik Csapak
2025-12-16  8:10 ` [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