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 984C61FF0B4 for ; Tue, 10 Nov 2026 13:24:58 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 1ED6E2149A; Tue, 10 Nov 2026 13:24:58 +0100 (CET) Message-ID: <538154a9-fa0d-4e04-9b62-9a2e70355c03@proxmox.com> Date: Tue, 10 Nov 2026 13:24:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH proxmox-backup] fix #7964: tape: make barcode-label task abortable To: Jakob-Tobias Winter , pbs-devel@lists.proxmox.com References: <20261106093422.1637066-2-tobias@stuttgart.de> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20261106093422.1637066-2-tobias@stuttgart.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794313492996 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.314 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: 4RYLLEMCO6C47TOU7VNVIG4WUAHAVSBD X-Message-ID-Hash: 4RYLLEMCO6C47TOU7VNVIG4WUAHAVSBD 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: LGTM Reviewed-by: Dominik Csapak Tested-by: Dominik Csapak On 11/6/26 10:42 AM, Jakob-Tobias Winter wrote: > The barcode-label-media worker never checked whether an abort was > requested, so pressing stop in the GUI had no effect and the task kept > loading and labeling every unlabeled tape in the changer. > > Check for an abort request before each tape is loaded, and again before > the label is written, since loading the media can take a while. A load > or label write that is already running cannot be interrupted, so those > operations still run to completion. > > Signed-off-by: Jakob-Tobias Winter > --- > Tested on PBS 4.2.8 (patch applied on top of 4.2.8-1) with a real tape > library: stopping the barcode-label task now aborts after the current > load, without labeling the loaded tape or loading the next one. > > src/api2/tape/drive.rs | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs > index 79b3b269c..3d8cca128 100644 > --- a/src/api2/tape/drive.rs > +++ b/src/api2/tape/drive.rs > @@ -30,6 +30,7 @@ use pbs_tape::{ > sg_tape::tape_alert_flags_critical, > }; > use proxmox_rest_server::WorkerTask; > +use proxmox_worker_task::WorkerTaskContext; > > use crate::{ > api2::tape::restore::{fast_catalog_restore, restore_media}, > @@ -1040,13 +1041,14 @@ pub fn barcode_label_media( > drive.clone(), > "barcode-label-media", > Some(drive.clone()), > - move |_worker, config| barcode_label_media_worker(drive, &config, pool), > + move |worker, config| barcode_label_media_worker(&worker, drive, &config, pool), > )?; > > Ok(upid_str.into()) > } > > fn barcode_label_media_worker( > + worker: &WorkerTask, > drive: String, > drive_config: &SectionConfigData, > pool: Option, > @@ -1076,6 +1078,10 @@ fn barcode_label_media_worker( > continue; > } > > + // loading and labeling a tape cannot be interrupted, so check > + // before starting with the next one > + worker.check_abort()?; > + > inventory.reload()?; > match inventory.find_media_by_label_text(&label_text) { > Ok(Some(_)) => { > @@ -1112,6 +1118,9 @@ fn barcode_label_media_worker( > } > } > > + // loading the media can take a while, so check again before writing the label > + worker.check_abort()?; > + > let ctime = proxmox_time::epoch_i64(); > let label = MediaLabel { > label_text: label_text.to_string(),