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 2FC031FF0B3 for ; Wed, 11 Nov 2026 13:03:40 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 704C421789; Wed, 11 Nov 2026 13:02:24 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu v2 1/9] patches/extra: allow mirror job to use non-root block node Date: Wed, 11 Nov 2026 13:01:40 +0100 Message-ID: <20261111120211.110737-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261111120211.110737-1-f.ebner@proxmox.com> References: <20261111120211.110737-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794398534583 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.279 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: U2T5BRAACB6QLRIF2ANFY2J4VQV7HFBB X-Message-ID-Hash: U2T5BRAACB6QLRIF2ANFY2J4VQV7HFBB X-MailFrom: f.ebner@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 VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Cherry-pick commit bb70b73cd5 ("blockdev: mirror: do not require a root block node") from upstream master in preparation to fix the regression from issue #7299: the I/O limits intended for the guest only wrongly apply to blockdev mirror. Signed-off-by: Fiona Ebner --- Changes in v2: * Cherry-pick the version that landed upstream. ...d-support-for-sync-bitmap-mode-never.patch | 10 +- ...check-for-bitmap-mode-without-bitmap.patch | 2 +- .../0006-mirror-move-some-checks-to-qmp.patch | 2 +- ...ror-do-not-require-a-root-block-node.patch | 96 +++++++++++++++++++ ...add-the-zeroinit-block-driver-filter.patch | 2 +- ...le-posix-make-locking-optiono-on-cre.patch | 2 +- ...ckup-Proxmox-backup-patches-for-QEMU.patch | 4 +- ...k-driver-to-map-backup-archives-into.patch | 2 +- ...igrate-dirty-bitmap-state-via-savevm.patch | 2 +- .../0035-block-add-alloc-track-driver.patch | 2 +- .../0036-PVE-backup-add-fleecing-option.patch | 2 +- ...ment-backup-access-setup-and-teardow.patch | 2 +- debian/patches/series | 1 + 13 files changed, 113 insertions(+), 16 deletions(-) create mode 100644 debian/patches/extra/0007-blockdev-mirror-do-not-require-a-root-block-node.patch diff --git a/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch b/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch index 8b0740a093..0306c3eb62 100644 --- a/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch +++ b/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch @@ -229,7 +229,7 @@ index 089856f4a8..e6f645e0f2 100644 base_read_only, errp); if (!job) { diff --git a/blockdev.c b/blockdev.c -index 6e86c6262f..b68dfef260 100644 +index 0f70973326..aa39048dd5 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2859,6 +2859,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, @@ -289,7 +289,7 @@ index 6e86c6262f..b68dfef260 100644 target_is_zero, on_source_error, on_target_error, unmap, filter_node_name, copy_mode, errp); } -@@ -3111,6 +3138,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) +@@ -3117,6 +3144,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) blockdev_mirror_common(arg->job_id, bs, target_bs, arg->replaces, arg->sync, @@ -298,7 +298,7 @@ index 6e86c6262f..b68dfef260 100644 backing_mode, target_is_zero, arg->has_speed, arg->speed, arg->has_granularity, arg->granularity, -@@ -3130,6 +3159,8 @@ void qmp_blockdev_mirror(const char *job_id, +@@ -3136,6 +3165,8 @@ void qmp_blockdev_mirror(const char *job_id, const char *device, const char *target, const char *replaces, MirrorSyncMode sync, @@ -307,7 +307,7 @@ index 6e86c6262f..b68dfef260 100644 bool has_speed, int64_t speed, bool has_granularity, uint32_t granularity, bool has_buf_size, int64_t buf_size, -@@ -3168,7 +3199,8 @@ void qmp_blockdev_mirror(const char *job_id, +@@ -3182,7 +3213,8 @@ void qmp_blockdev_mirror(const char *job_id, } blockdev_mirror_common(job_id, bs, target_bs, @@ -333,7 +333,7 @@ index e7c8f1a856..d5aa68caeb 100644 BlockdevOnError on_source_error, BlockdevOnError on_target_error, diff --git a/qapi/block-core.json b/qapi/block-core.json -index 199efc1e00..28d9c1e98e 100644 +index 48600206ec..03005334e5 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2280,6 +2280,15 @@ diff --git a/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch b/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch index dadb0e6f85..773139a4ab 100644 --- a/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch +++ b/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch @@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 3 insertions(+) diff --git a/blockdev.c b/blockdev.c -index b68dfef260..878e47a321 100644 +index aa39048dd5..1d0494a090 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2952,6 +2952,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, diff --git a/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch b/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch index 98c3f7b93d..abf1f03770 100644 --- a/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch +++ b/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch @@ -62,7 +62,7 @@ index 0f56ad1f54..75563e6e75 100644 if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) { diff --git a/blockdev.c b/blockdev.c -index 878e47a321..d9575c8367 100644 +index 1d0494a090..9da3f5b8bb 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2931,7 +2931,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, diff --git a/debian/patches/extra/0007-blockdev-mirror-do-not-require-a-root-block-node.patch b/debian/patches/extra/0007-blockdev-mirror-do-not-require-a-root-block-node.patch new file mode 100644 index 0000000000..70109f219b --- /dev/null +++ b/debian/patches/extra/0007-blockdev-mirror-do-not-require-a-root-block-node.patch @@ -0,0 +1,96 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fiona Ebner +Date: Tue, 6 Oct 2026 13:42:17 +0200 +Subject: [PATCH] blockdev: mirror: do not require a root block node + +The mirror block job currently only operates on a root block node. It +might be desired to use a throttle node as the root node for limiting +the guest IO, without also limiting mirror operations. + +There is no obvious reason why mirror should only be able to operate +on a root block node. + +When there is no explicit @replaces argument, implicit filters on top +are skipped. Allowing mirror to operate on non-root nodes does not +change that fact and keeps the behavior consistent with the +documentation for @replaces. + +Signed-off-by: Fiona Ebner +Message-ID: <20261006114240.478523-3-f.ebner@proxmox.com> +Reviewed-by: Eric Blake +Signed-off-by: Kevin Wolf +(cherry picked from commit bb70b73cd55f0110fb2b18c9ad84fe5b2fea0534) +Signed-off-by: Fiona Ebner +--- + blockdev.c | 20 +++++++++++++++++--- + qapi/block-core.json | 4 ++-- + 2 files changed, 19 insertions(+), 5 deletions(-) + +diff --git a/blockdev.c b/blockdev.c +index 6e86c6262f..0f70973326 100644 +--- a/blockdev.c ++++ b/blockdev.c +@@ -2987,13 +2987,19 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) + bool target_is_zero; + int ret; + +- bs = qmp_get_root_bs(arg->device, errp); ++ bdrv_graph_rdlock_main_loop(); ++ bs = bdrv_lookup_bs(arg->device, arg->device, errp); + if (!bs) { ++ bdrv_graph_rdunlock_main_loop(); ++ return; ++ } ++ if (!bdrv_is_inserted(bs)) { ++ error_setg(errp, "Device has no medium"); ++ bdrv_graph_rdunlock_main_loop(); + return; + } + + /* Early check to avoid creating target */ +- bdrv_graph_rdlock_main_loop(); + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_MIRROR_SOURCE, errp)) { + bdrv_graph_rdunlock_main_loop(); + return; +@@ -3150,10 +3156,18 @@ void qmp_blockdev_mirror(const char *job_id, + BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN; + int ret; + +- bs = qmp_get_root_bs(device, errp); ++ bdrv_graph_rdlock_main_loop(); ++ bs = bdrv_lookup_bs(device, device, errp); + if (!bs) { ++ bdrv_graph_rdunlock_main_loop(); + return; + } ++ if (!bdrv_is_inserted(bs)) { ++ error_setg(errp, "Device has no medium"); ++ bdrv_graph_rdunlock_main_loop(); ++ return; ++ } ++ bdrv_graph_rdunlock_main_loop(); + + target_bs = bdrv_lookup_bs(target, target, errp); + if (!target_bs) { +diff --git a/qapi/block-core.json b/qapi/block-core.json +index 199efc1e00..48600206ec 100644 +--- a/qapi/block-core.json ++++ b/qapi/block-core.json +@@ -2253,7 +2253,7 @@ + # @job-id: identifier for the newly-created block job. If omitted, + # the device name will be used. (Since 2.7) + # +-# @device: the device name or node-name of a root node whose writes ++# @device: the device name or node-name of a block node whose writes + # should be mirrored. + # + # @target: the target of the new image. If the file exists, or if it +@@ -2583,7 +2583,7 @@ + # @job-id: identifier for the newly-created block job. If omitted, + # the device name will be used. (Since 2.7) + # +-# @device: The device name or node-name of a root node whose writes ++# @device: The device name or node-name of a block node whose writes + # should be mirrored. + # + # @target: the id or node-name of the block device to mirror to. This diff --git a/debian/patches/pve/0017-PVE-block-add-the-zeroinit-block-driver-filter.patch b/debian/patches/pve/0017-PVE-block-add-the-zeroinit-block-driver-filter.patch index c88df54d03..9f910164a6 100644 --- a/debian/patches/pve/0017-PVE-block-add-the-zeroinit-block-driver-filter.patch +++ b/debian/patches/pve/0017-PVE-block-add-the-zeroinit-block-driver-filter.patch @@ -247,7 +247,7 @@ index 0000000000..036edb17f5 + +block_init(bdrv_zeroinit_init); diff --git a/qapi/block-core.json b/qapi/block-core.json -index 28d9c1e98e..07d16c4a04 100644 +index 03005334e5..20f5d21ef4 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3377,7 +3377,7 @@ diff --git a/debian/patches/pve/0020-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch b/debian/patches/pve/0020-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch index a6a1076be7..f4f499c349 100644 --- a/debian/patches/pve/0020-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch +++ b/debian/patches/pve/0020-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch @@ -119,7 +119,7 @@ index 2c29ee7819..73e7eb3cd2 100644 }; return raw_co_create(&options, errp); diff --git a/qapi/block-core.json b/qapi/block-core.json -index 07d16c4a04..a12a1a2747 100644 +index 20f5d21ef4..eecd8e1d7d 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -5130,6 +5130,10 @@ diff --git a/debian/patches/pve/0027-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch b/debian/patches/pve/0027-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch index e5d76c54c0..82891d7ea9 100644 --- a/debian/patches/pve/0027-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch +++ b/debian/patches/pve/0027-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch @@ -165,7 +165,7 @@ index 69ade0534f..77abc58cb1 100644 + hmp_handle_error(mon, error); +} diff --git a/blockdev.c b/blockdev.c -index d9575c8367..38e24e12bd 100644 +index 9da3f5b8bb..3a9f557f5b 100644 --- a/blockdev.c +++ b/blockdev.c @@ -37,6 +37,7 @@ @@ -1685,7 +1685,7 @@ index 0000000000..177fb851b4 + return ret; +} diff --git a/qapi/block-core.json b/qapi/block-core.json -index a12a1a2747..e66c455f6e 100644 +index eecd8e1d7d..eb814b3b8d 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -952,6 +952,248 @@ diff --git a/debian/patches/pve/0029-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch b/debian/patches/pve/0029-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch index 0dbc77f807..e1d93ba6ef 100644 --- a/debian/patches/pve/0029-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch +++ b/debian/patches/pve/0029-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch @@ -361,7 +361,7 @@ index 91de400570..b1cbaa100e 100644 summary_info += {'libdaxctl support': libdaxctl} summary_info += {'libcbor support': libcbor} diff --git a/qapi/block-core.json b/qapi/block-core.json -index e66c455f6e..ca18144902 100644 +index eb814b3b8d..1001dbc96b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3615,6 +3615,7 @@ diff --git a/debian/patches/pve/0031-PVE-Migrate-dirty-bitmap-state-via-savevm.patch b/debian/patches/pve/0031-PVE-Migrate-dirty-bitmap-state-via-savevm.patch index f14c756faa..5860c2f4f9 100644 --- a/debian/patches/pve/0031-PVE-Migrate-dirty-bitmap-state-via-savevm.patch +++ b/debian/patches/pve/0031-PVE-Migrate-dirty-bitmap-state-via-savevm.patch @@ -200,7 +200,7 @@ index 177fb851b4..7575abab7c 100644 ret->pbs_masterkey = true; ret->backup_max_workers = true; diff --git a/qapi/block-core.json b/qapi/block-core.json -index ca18144902..91efb9922e 100644 +index 1001dbc96b..ce072f5756 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1112,6 +1112,11 @@ diff --git a/debian/patches/pve/0035-block-add-alloc-track-driver.patch b/debian/patches/pve/0035-block-add-alloc-track-driver.patch index b54317dd3e..e6071c18cd 100644 --- a/debian/patches/pve/0035-block-add-alloc-track-driver.patch +++ b/debian/patches/pve/0035-block-add-alloc-track-driver.patch @@ -449,7 +449,7 @@ index d023753091..a777c8079c 100644 out: diff --git a/qapi/block-core.json b/qapi/block-core.json -index 91efb9922e..80ffcc0547 100644 +index ce072f5756..a0275b4b28 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3608,7 +3608,8 @@ diff --git a/debian/patches/pve/0036-PVE-backup-add-fleecing-option.patch b/debian/patches/pve/0036-PVE-backup-add-fleecing-option.patch index dbcf3bb65f..5023d57372 100644 --- a/debian/patches/pve/0036-PVE-backup-add-fleecing-option.patch +++ b/debian/patches/pve/0036-PVE-backup-add-fleecing-option.patch @@ -429,7 +429,7 @@ index 7575abab7c..8b83465ebd 100644 return ret; } diff --git a/qapi/block-core.json b/qapi/block-core.json -index 80ffcc0547..62d7fb4e7a 100644 +index a0275b4b28..cb5cbe9402 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1054,6 +1054,10 @@ diff --git a/debian/patches/pve/0042-PVE-backup-implement-backup-access-setup-and-teardow.patch b/debian/patches/pve/0042-PVE-backup-implement-backup-access-setup-and-teardow.patch index ddd7b1ca3e..a348dfd902 100644 --- a/debian/patches/pve/0042-PVE-backup-implement-backup-access-setup-and-teardow.patch +++ b/debian/patches/pve/0042-PVE-backup-implement-backup-access-setup-and-teardow.patch @@ -740,7 +740,7 @@ index 0000000000..9ebeef7c8f + +#endif /* PVE_BACKUP_H */ diff --git a/qapi/block-core.json b/qapi/block-core.json -index 62d7fb4e7a..5e50776664 100644 +index cb5cbe9402..13f9d66430 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1128,6 +1128,9 @@ diff --git a/debian/patches/series b/debian/patches/series index 1828cca017..1807e4a66e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,6 +4,7 @@ extra/0003-block-vmdk-tolerate-known-seSparse-reserved1-bit.patch extra/0004-hw-scsi-lsi53c895a-gracefully-handle-re-entrant-DMA.patch extra/0005-qapi-virtio-Restore-backend-features-in-x-query-virt.patch extra/0006-qapi-monitor-Handle-missing-vhost-user-protocol-feat.patch +extra/0007-blockdev-mirror-do-not-require-a-root-block-node.patch bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch -- 2.47.3