From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 419FA1FF178 for ; Mon, 15 Dec 2025 14:59:09 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6D986CD88; Mon, 15 Dec 2025 14:59:54 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 15 Dec 2025 14:59:44 +0100 Message-ID: <20251215135951.2827702-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.031 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup] tape: fix encryption on certain tape drives X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "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 --- 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( // Warning: this blocks and fails if there is no media loaded #[allow(clippy::vec_init_then_push)] fn sg_spin_data_encryption_status(file: &mut F) -> Result, 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(file: &mut F) -> Result, E // Warning: this blocks and fails if there is no media loaded #[allow(clippy::vec_init_then_push)] fn sg_spin_data_encryption_caps(file: &mut F) -> Result, 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