From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id E6F051FF0C2 for ; Thu, 03 Dec 2026 14:10:21 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4F5B22172D; Thu, 03 Dec 2026 14:10:21 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup] tape: increase write timeouts to recommended values Date: Thu, 3 Dec 2026 14:03:17 +0100 Message-ID: <20261203131016.2641111-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.240 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: O3IC77DDWS2TWST4ZLHYIEP4XJKPY2NS X-Message-ID-Hash: O3IC77DDWS2TWST4ZLHYIEP4XJKPY2NS X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If tape write does not finish within it's set timeout, the kernel tries to abort the command and returns 'transport error'. This can mask the actual reason or abort the write prematurely in case it took longer than expected. Recommended timeout values differ by LTO version and vendor, but they are much larger than our current 600 seconds. The recommended values are there so the drive can recover in case of an error or writing out its write buffer. Use values from IBMs LTO SCSI reference for half-height LTO-6 drives, since those are larger than others (HP, full-height and newer LTO versions). Downside to this is in case the drive truly hangs, the job is aborted after a longer period instead of 10 minutes. Signed-off-by: Dominik Csapak --- There are two alternative approaches here that would be valid IMO: * The linux kernel uses 900 s as timeout, which is still under the recommended value, but higher than what we have. IMO this does not improve the status quo, but at least there would be precedence. * Query the drives timeout values with `REPORT SUPPORTED OPERATION CODES` (A3h) command. This is supported on newer drives and can report a recommened timeout dynamically. We'd still have to have a fallback since not all drives support these. I think longterm this would be nice to have, but it's a much larger effort and ultimately won't change the behavior drastically compared to this patch. pbs-tape/src/sg_tape.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pbs-tape/src/sg_tape.rs b/pbs-tape/src/sg_tape.rs index a98e8960a..c3caa401d 100644 --- a/pbs-tape/src/sg_tape.rs +++ b/pbs-tape/src/sg_tape.rs @@ -614,7 +614,8 @@ impl SgTape { proxmox_lang::io_format_err!("write_filemarks failed (alloc) - {err}") })?; - sg_raw.set_timeout(Self::SCSI_TAPE_DEFAULT_TIMEOUT); + // IBM LTO reference recommends 1740 s timeout for half-height LTO-6 drives. + sg_raw.set_timeout(1740); let mut cmd = vec![0x10]; if immediate { cmd.push(1); // IMMED=1 @@ -766,7 +767,8 @@ impl SgTape { let mut sg_raw = SgRaw::new(&mut self.file, 0).unwrap(); // cannot fail with size 0 - sg_raw.set_timeout(Self::SCSI_TAPE_DEFAULT_TIMEOUT); + // IBM LTO reference recommends 1920s timeout for half-height LTO-6 drives. + sg_raw.set_timeout(1920); let mut cmd = Vec::new(); cmd.push(0x0A); // WRITE cmd.push(0x00); // VARIABLE SIZED BLOCKS -- 2.47.3