From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 5E6CA1FF0AB for ; Mon, 07 Sep 2026 11:48:11 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 21D27215D2; Mon, 07 Sep 2026 11:47:57 +0200 (CEST) From: Erik Fastermann To: pve-devel@lists.proxmox.com Subject: [PATCH qemu v2 2/9] pbs-restore: keep callback data on the stack Date: Mon, 7 Sep 2026 11:47:36 +0200 Message-ID: <20260907094744.131193-3-e.fastermann@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907094744.131193-1-e.fastermann@proxmox.com> References: <20260907094744.131193-1-e.fastermann@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.510 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) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: LEQQY2QNPUBOHARLXRTHY5UMU5FGBFZ3 X-Message-ID-Hash: LEQQY2QNPUBOHARLXRTHY5UMU5FGBFZ3 X-MailFrom: efastermann@ruth.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 CC: Erik Fastermann X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: proxmox_restore_image() is synchronous and only hands the pointer back to the callback, so the lifetime is the enclosing scope. Dropping the heap allocation also drops its missing free and calloc() call, which is discouraged in QEMU. Signed-off-by: Erik Fastermann --- ...s-restore-new-command-to-restore-from-p.patch | 16 +++++++++------- ...dd-no-cache-flag-to-skip-host-page-cach.patch | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/debian/patches/pve/0030-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch b/debian/patches/pve/0030-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch index 6d5bb42..bd11662 100644 --- a/debian/patches/pve/0030-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch +++ b/debian/patches/pve/0030-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch @@ -7,6 +7,8 @@ Subject: [PATCH] PVE-Backup: pbs-restore - new command to restore from proxmox Signed-off-by: Thomas Lamprecht [WB: add namespace support] Signed-off-by: Wolfgang Bumiller +[EF: keep callback data on the stack] +Signed-off-by: Erik Fastermann --- meson.build | 4 + pbs-restore.c | 236 ++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -30,7 +32,7 @@ index 1eee80f7d8..b7a8702711 100644 foreach exe: [ 'qemu-img', 'qemu-io', 'qemu-nbd', 'qemu-storage-daemon'] diff --git a/pbs-restore.c b/pbs-restore.c new file mode 100644 -index 0000000000..f165f418af +index 0000000000..f5e3552193 --- /dev/null +++ b/pbs-restore.c @@ -0,0 +1,236 @@ @@ -240,11 +242,11 @@ index 0000000000..f165f418af + return -1; + } + -+ CallbackData *callback_data = calloc(sizeof(CallbackData), 1); -+ -+ callback_data->target = blk; -+ callback_data->skip_zero = skip_zero; -+ callback_data->last_offset = 0; ++ CallbackData callback_data = { ++ .target = blk, ++ .skip_zero = skip_zero, ++ .last_offset = 0, ++ }; + + // blk_set_enable_write_cache(blk, !writethrough); + @@ -256,7 +258,7 @@ index 0000000000..f165f418af + conn, + archive_name, + write_callback, -+ callback_data, ++ &callback_data, + &pbs_error, + verbose); + diff --git a/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch b/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch index 3ef6e69..7b79722 100644 --- a/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch +++ b/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch @@ -25,7 +25,7 @@ Signed-off-by: Christian Ebner 1 file changed, 11 insertions(+) diff --git a/pbs-restore.c b/pbs-restore.c -index f165f418af..55a3cb235d 100644 +index f5e3552193..592b20f7ad 100644 --- a/pbs-restore.c +++ b/pbs-restore.c @@ -81,6 +81,7 @@ int main(int argc, char **argv) -- 2.47.3