From: Dominik Csapak <d.csapak@proxmox.com>
To: Jakob-Tobias Winter <tobias@stuttgart.de>, pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup] fix #7964: tape: make barcode-label task abortable
Date: Tue, 10 Nov 2026 13:24:52 +0100 [thread overview]
Message-ID: <538154a9-fa0d-4e04-9b62-9a2e70355c03@proxmox.com> (raw)
In-Reply-To: <20261106093422.1637066-2-tobias@stuttgart.de>
LGTM
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
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 <tobias@stuttgart.de>
> ---
> 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<String>,
> @@ -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(),
next prev parent reply other threads:[~2026-11-10 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 9:33 [PATCH proxmox-backup] fix #7964: tape: make barcode-label task abortable Jakob-Tobias Winter
2026-11-10 12:24 ` Dominik Csapak [this message]
2026-11-10 16:35 ` applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=538154a9-fa0d-4e04-9b62-9a2e70355c03@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=tobias@stuttgart.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox