From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 16ADF60845 for ; Wed, 2 Feb 2022 14:19:01 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 045381C378 for ; Wed, 2 Feb 2022 14:18:31 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 4D8281C36C for ; Wed, 2 Feb 2022 14:18:25 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 243694612D for ; Wed, 2 Feb 2022 14:18:25 +0100 (CET) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Wed, 2 Feb 2022 14:18:15 +0100 Message-Id: <20220202131815.365141-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.238 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LOTSOFHASH 0.25 Emails with lots of hash-like gibberish KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - X-Mailman-Approved-At: Wed, 02 Feb 2022 14:28:46 +0100 Subject: [pve-devel] [RFC qemu] update submodule and patches to 6.2.0 X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2022 13:19:01 -0000 Notable changes: * bdrv_co_p{discard,readv,writev,write_zeroes} function signatures changed, to using int64_t for offsets/bytes and some still had int rather than BrdvRequestFlags for the flags. * job_cancel_sync now has a force parameter. Commit messages in 73895f3838cd7fdaf185cf1dbc47be58844a966f 4cfb3f05627ad82af473e7f7ae113c3884cd04e3 sound like using force=true makes more sense. * Added 3 patches coming in via qemu-stable tag, most important one is to work around a librbd issue. * cluster_size calculation helper changed (see patch pve/0026). * QAPI's if conditionals now use 'CONFIG_FOO' rather than 'defined(CONFIG_FOO)' Signed-off-by: Fabian Ebner --- Sent as RFC, because it's my first time rebasing our QEMU patches and because of the following outstanding issue (found while playing around with Stefan R.'s Autotest): https://lists.nongnu.org/archive/html/qemu-devel/2022-02/msg00381.html ...d-support-for-sync-bitmap-mode-never.patch | 64 ++++++------- ...-support-for-conditional-and-always-.patch | 10 +-- ...check-for-bitmap-mode-without-bitmap.patch | 4 +- ...-to-bdrv_dirty_bitmap_merge_internal.patch | 6 +- .../0006-mirror-move-some-checks-to-qmp.patch | 8 +- ...race-with-clients-disconnecting-earl.patch | 14 +-- ...support-for-flag-argument-with-value.patch | 6 +- ...-set-expire_password-and-allow-VNC-d.patch | 42 +++++---- ...-NULL-pointer-dereference-in-mirror_.patch | 83 ----------------- ...ndling-of-holes-in-.bdrv_co_block_st.patch | 46 ++++++++++ ...-rbd-workaround-for-ceph-issue-53784.patch | 90 +++++++++++++++++++ ...Update-BSC-only-if-want_zero-is-true.patch | 43 +++++++++ ...k-file-change-locking-default-to-off.patch | 6 +- ...djust-network-script-path-to-etc-kvm.patch | 4 +- ...he-CPU-model-to-kvm64-32-instead-of-.patch | 6 +- ...ui-spice-default-to-pve-certificates.patch | 4 +- ...erfs-no-default-logfile-if-daemonize.patch | 2 +- ...lock-rbd-disable-rbd_cache_writethro.patch | 4 +- .../0007-PVE-Up-qmp-add-get_link_status.patch | 4 +- ...PVE-Up-glusterfs-allow-partial-reads.patch | 14 +-- ...return-success-on-info-without-snaps.patch | 4 +- ...dd-add-osize-and-read-from-to-stdin-.patch | 16 ++-- ...E-Up-qemu-img-dd-add-isize-parameter.patch | 12 +-- ...PVE-Up-qemu-img-dd-add-n-skip_create.patch | 10 +-- ...virtio-balloon-improve-query-balloon.patch | 10 +-- .../0014-PVE-qapi-modify-query-machines.patch | 6 +- .../0015-PVE-qapi-modify-spice-query.patch | 6 +- ...async-for-background-state-snapshots.patch | 46 +++++----- ...add-the-zeroinit-block-driver-filter.patch | 18 ++-- ...-Add-dummy-id-command-line-parameter.patch | 14 +-- ...le-posix-make-locking-optiono-on-cre.patch | 18 ++-- ...sed-balloon-qemu-4-0-config-size-fal.patch | 4 +- ...E-Allow-version-code-in-machine-type.patch | 18 ++-- ...VE-Backup-add-vma-backup-format-code.patch | 18 ++-- ...-Backup-add-backup-dump-block-driver.patch | 38 ++++---- ...ckup-proxmox-backup-patches-for-qemu.patch | 56 ++++++------ ...estore-new-command-to-restore-from-p.patch | 4 +- ...irty-bitmap-tracking-for-incremental.patch | 16 ++-- .../pve/0030-PVE-various-PBS-fixes.patch | 10 +-- ...k-driver-to-map-backup-archives-into.patch | 73 ++++++++------- ...dd-query_proxmox_support-QMP-command.patch | 6 +- ...E-add-query-pbs-bitmap-info-QMP-call.patch | 12 +-- ...ct-stderr-to-journal-when-daemonized.patch | 8 +- ...d-sequential-job-transaction-support.patch | 10 +-- ...-transaction-to-synchronize-job-stat.patch | 10 ++- ...-block-on-finishing-and-cleanup-crea.patch | 14 +-- ...igrate-dirty-bitmap-state-via-savevm.patch | 14 +-- ...dirty-bitmap-migrate-other-bitmaps-e.patch | 2 +- ...all-back-to-open-iscsi-initiatorname.patch | 4 +- ...routine-QMP-for-backup-cancel_backup.patch | 12 +-- .../pve/0042-PBS-add-master-key-support.patch | 14 +-- ...st-path-reads-without-allocation-if-.patch | 8 +- ...PVE-block-stream-increase-chunk-size.patch | 2 +- ...accept-NULL-qiov-in-bdrv_pad_request.patch | 4 +- .../0046-block-add-alloc-track-driver.patch | 29 +++--- debian/patches/series | 4 +- qemu | 2 +- 57 files changed, 564 insertions(+), 448 deletions(-) delete mode 100644 debian/patches/extra/0004-block-mirror-fix-NULL-pointer-dereference-in-mirror_.patch create mode 100644 debian/patches/extra/0004-block-rbd-fix-handling-of-holes-in-.bdrv_co_block_st.patch create mode 100644 debian/patches/extra/0005-block-rbd-workaround-for-ceph-issue-53784.patch create mode 100644 debian/patches/extra/0006-block-io-Update-BSC-only-if-want_zero-is-true.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 853cc8f..61ce22a 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 @@ -36,7 +36,7 @@ Signed-off-by: Thomas Lamprecht 5 files changed, 145 insertions(+), 29 deletions(-) diff --git a/block/mirror.c b/block/mirror.c -index 85b781bc21..0821214138 100644 +index efec2c7674..f7804638f9 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -50,7 +50,7 @@ typedef struct MirrorBlockJob { @@ -48,7 +48,7 @@ index 85b781bc21..0821214138 100644 BlockMirrorBackingMode backing_mode; /* Whether the target image requires explicit zero-initialization */ bool zero_target; -@@ -65,6 +65,8 @@ typedef struct MirrorBlockJob { +@@ -64,6 +64,8 @@ typedef struct MirrorBlockJob { size_t buf_size; int64_t bdev_length; unsigned long *cow_bitmap; @@ -57,7 +57,7 @@ index 85b781bc21..0821214138 100644 BdrvDirtyBitmap *dirty_bitmap; BdrvDirtyBitmapIter *dbi; uint8_t *buf; -@@ -697,7 +699,8 @@ static int mirror_exit_common(Job *job) +@@ -695,7 +697,8 @@ static int mirror_exit_common(Job *job) bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing, &error_abort); if (!abort && s->backing_mode == MIRROR_SOURCE_BACKING_CHAIN) { @@ -67,7 +67,7 @@ index 85b781bc21..0821214138 100644 BlockDriverState *unfiltered_target = bdrv_skip_filters(target_bs); if (bdrv_cow_bs(unfiltered_target) != backing) { -@@ -802,6 +805,16 @@ static void mirror_abort(Job *job) +@@ -800,6 +803,16 @@ static void mirror_abort(Job *job) assert(ret == 0); } @@ -84,7 +84,7 @@ index 85b781bc21..0821214138 100644 static void coroutine_fn mirror_throttle(MirrorBlockJob *s) { int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); -@@ -983,7 +996,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp) +@@ -979,7 +992,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp) mirror_free_init(s); s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); @@ -94,7 +94,7 @@ index 85b781bc21..0821214138 100644 ret = mirror_dirty_init(s); if (ret < 0 || job_is_cancelled(&s->common.job)) { goto immediate_exit; -@@ -1216,6 +1230,7 @@ static const BlockJobDriver mirror_job_driver = { +@@ -1221,6 +1235,7 @@ static const BlockJobDriver mirror_job_driver = { .run = mirror_run, .prepare = mirror_prepare, .abort = mirror_abort, @@ -102,15 +102,15 @@ index 85b781bc21..0821214138 100644 .pause = mirror_pause, .complete = mirror_complete, .cancel = mirror_cancel, -@@ -1232,6 +1247,7 @@ static const BlockJobDriver commit_active_job_driver = { +@@ -1237,6 +1252,7 @@ static const BlockJobDriver commit_active_job_driver = { .run = mirror_run, .prepare = mirror_prepare, .abort = mirror_abort, + .clean = mirror_clean, .pause = mirror_pause, .complete = mirror_complete, - }, -@@ -1594,7 +1610,10 @@ static BlockJob *mirror_start_job( + .cancel = commit_active_cancel, +@@ -1602,7 +1618,10 @@ static BlockJob *mirror_start_job( BlockCompletionFunc *cb, void *opaque, const BlockJobDriver *driver, @@ -122,7 +122,7 @@ index 85b781bc21..0821214138 100644 bool auto_complete, const char *filter_node_name, bool is_mirror, MirrorCopyMode copy_mode, Error **errp) -@@ -1606,10 +1625,39 @@ static BlockJob *mirror_start_job( +@@ -1614,10 +1633,39 @@ static BlockJob *mirror_start_job( uint64_t target_perms, target_shared_perms; int ret; @@ -164,7 +164,7 @@ index 85b781bc21..0821214138 100644 assert(is_power_of_2(granularity)); if (buf_size < 0) { -@@ -1747,7 +1795,9 @@ static BlockJob *mirror_start_job( +@@ -1755,7 +1803,9 @@ static BlockJob *mirror_start_job( s->replaces = g_strdup(replaces); s->on_source_error = on_source_error; s->on_target_error = on_target_error; @@ -175,7 +175,7 @@ index 85b781bc21..0821214138 100644 s->backing_mode = backing_mode; s->zero_target = zero_target; s->copy_mode = copy_mode; -@@ -1768,6 +1818,18 @@ static BlockJob *mirror_start_job( +@@ -1776,6 +1826,18 @@ static BlockJob *mirror_start_job( bdrv_disable_dirty_bitmap(s->dirty_bitmap); } @@ -194,7 +194,7 @@ index 85b781bc21..0821214138 100644 ret = block_job_add_bdrv(&s->common, "source", bs, 0, BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE | BLK_PERM_CONSISTENT_READ, -@@ -1845,6 +1907,9 @@ fail: +@@ -1853,6 +1915,9 @@ fail: if (s->dirty_bitmap) { bdrv_release_dirty_bitmap(s->dirty_bitmap); } @@ -204,7 +204,7 @@ index 85b781bc21..0821214138 100644 job_early_fail(&s->common.job); } -@@ -1862,29 +1927,23 @@ void mirror_start(const char *job_id, BlockDriverState *bs, +@@ -1870,29 +1935,23 @@ void mirror_start(const char *job_id, BlockDriverState *bs, BlockDriverState *target, const char *replaces, int creation_flags, int64_t speed, uint32_t granularity, int64_t buf_size, @@ -239,7 +239,7 @@ index 85b781bc21..0821214138 100644 } BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs, -@@ -1909,7 +1968,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs, +@@ -1917,7 +1976,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs, job_id, bs, creation_flags, base, NULL, speed, 0, 0, MIRROR_LEAVE_BACKING_CHAIN, false, on_error, on_error, true, cb, opaque, @@ -250,10 +250,10 @@ index 85b781bc21..0821214138 100644 errp); if (!job) { diff --git a/blockdev.c b/blockdev.c -index 3d8ac368a1..03e99264dc 100644 +index b35072644e..9940116fe0 100644 --- a/blockdev.c +++ b/blockdev.c -@@ -2957,6 +2957,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, +@@ -2956,6 +2956,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, BlockDriverState *target, bool has_replaces, const char *replaces, enum MirrorSyncMode sync, @@ -264,7 +264,7 @@ index 3d8ac368a1..03e99264dc 100644 BlockMirrorBackingMode backing_mode, bool zero_target, bool has_speed, int64_t speed, -@@ -2976,6 +2980,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, +@@ -2975,6 +2979,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, { BlockDriverState *unfiltered_bs; int job_flags = JOB_DEFAULT; @@ -272,7 +272,7 @@ index 3d8ac368a1..03e99264dc 100644 if (!has_speed) { speed = 0; -@@ -3030,6 +3035,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, +@@ -3029,6 +3034,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, sync = MIRROR_SYNC_MODE_FULL; } @@ -302,7 +302,7 @@ index 3d8ac368a1..03e99264dc 100644 if (!has_replaces) { /* We want to mirror from @bs, but keep implicit filters on top */ unfiltered_bs = bdrv_skip_implicit_filters(bs); -@@ -3076,8 +3104,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, +@@ -3075,8 +3103,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, * and will allow to check whether the node still exist at mirror completion */ mirror_start(job_id, bs, target, @@ -313,7 +313,7 @@ index 3d8ac368a1..03e99264dc 100644 on_source_error, on_target_error, unmap, filter_node_name, copy_mode, errp); } -@@ -3222,6 +3250,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) +@@ -3221,6 +3249,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs, arg->has_replaces, arg->replaces, arg->sync, @@ -322,7 +322,7 @@ index 3d8ac368a1..03e99264dc 100644 backing_mode, zero_target, arg->has_speed, arg->speed, arg->has_granularity, arg->granularity, -@@ -3243,6 +3273,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id, +@@ -3242,6 +3272,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id, const char *device, const char *target, bool has_replaces, const char *replaces, MirrorSyncMode sync, @@ -331,7 +331,7 @@ index 3d8ac368a1..03e99264dc 100644 bool has_speed, int64_t speed, bool has_granularity, uint32_t granularity, bool has_buf_size, int64_t buf_size, -@@ -3292,7 +3324,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id, +@@ -3291,7 +3323,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id, } blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs, @@ -342,10 +342,10 @@ index 3d8ac368a1..03e99264dc 100644 has_granularity, granularity, has_buf_size, buf_size, diff --git a/include/block/block_int.h b/include/block/block_int.h -index c31cbd034a..11442893d0 100644 +index f4c75e8ba9..ee0aeb1414 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h -@@ -1254,7 +1254,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs, +@@ -1287,7 +1287,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs, BlockDriverState *target, const char *replaces, int creation_flags, int64_t speed, uint32_t granularity, int64_t buf_size, @@ -357,10 +357,10 @@ index c31cbd034a..11442893d0 100644 BlockdevOnError on_source_error, BlockdevOnError on_target_error, diff --git a/qapi/block-core.json b/qapi/block-core.json -index 675d8265eb..6356a63695 100644 +index 1d3dd9cb48..da5dca1e3b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -1938,10 +1938,19 @@ +@@ -1995,10 +1995,19 @@ # (all the disk, only the sectors allocated in the topmost image, or # only new I/O). # @@ -381,7 +381,7 @@ index 675d8265eb..6356a63695 100644 # # @buf-size: maximum amount of data in flight from source to # target (since 1.4). -@@ -1979,7 +1988,9 @@ +@@ -2036,7 +2045,9 @@ { 'struct': 'DriveMirror', 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', '*format': 'str', '*node-name': 'str', '*replaces': 'str', @@ -392,7 +392,7 @@ index 675d8265eb..6356a63695 100644 '*speed': 'int', '*granularity': 'uint32', '*buf-size': 'int', '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', -@@ -2247,10 +2258,19 @@ +@@ -2308,10 +2319,19 @@ # (all the disk, only the sectors allocated in the topmost image, or # only new I/O). # @@ -413,7 +413,7 @@ index 675d8265eb..6356a63695 100644 # # @buf-size: maximum amount of data in flight from source to # target -@@ -2299,7 +2319,8 @@ +@@ -2360,7 +2380,8 @@ { 'command': 'blockdev-mirror', 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', '*replaces': 'str', @@ -424,10 +424,10 @@ index 675d8265eb..6356a63695 100644 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c -index c39e70b2f5..470ef79ae0 100644 +index aea660aeed..22b9770a3e 100644 --- a/tests/unit/test-block-iothread.c +++ b/tests/unit/test-block-iothread.c -@@ -617,8 +617,8 @@ static void test_propagate_mirror(void) +@@ -626,8 +626,8 @@ static void test_propagate_mirror(void) /* Start a mirror job */ mirror_start("job0", src, target, NULL, JOB_DEFAULT, 0, 0, 0, diff --git a/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch b/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch index 5dd0165..441198e 100644 --- a/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch +++ b/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch @@ -24,10 +24,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/block/mirror.c b/block/mirror.c -index 0821214138..c688726fae 100644 +index f7804638f9..4f5f74e2cf 100644 --- a/block/mirror.c +++ b/block/mirror.c -@@ -674,8 +674,6 @@ static int mirror_exit_common(Job *job) +@@ -672,8 +672,6 @@ static int mirror_exit_common(Job *job) bdrv_unfreeze_backing_chain(mirror_top_bs, target_bs); } @@ -36,7 +36,7 @@ index 0821214138..c688726fae 100644 /* Make sure that the source BDS doesn't go away during bdrv_replace_node, * before we can call bdrv_drained_end */ bdrv_ref(src); -@@ -783,6 +781,18 @@ static int mirror_exit_common(Job *job) +@@ -781,6 +779,18 @@ static int mirror_exit_common(Job *job) blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort); blk_insert_bs(bjob->blk, mirror_top_bs, &error_abort); @@ -55,7 +55,7 @@ index 0821214138..c688726fae 100644 bs_opaque->job = NULL; bdrv_drained_end(src); -@@ -1635,10 +1645,6 @@ static BlockJob *mirror_start_job( +@@ -1643,10 +1653,6 @@ static BlockJob *mirror_start_job( " sync mode", MirrorSyncMode_str(sync_mode)); return NULL; @@ -66,7 +66,7 @@ index 0821214138..c688726fae 100644 } } else if (bitmap) { error_setg(errp, -@@ -1655,6 +1661,12 @@ static BlockJob *mirror_start_job( +@@ -1663,6 +1669,12 @@ static BlockJob *mirror_start_job( return NULL; } granularity = bdrv_dirty_bitmap_granularity(bitmap); 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 9b1c40b..de15507 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,10 +16,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 3 insertions(+) diff --git a/blockdev.c b/blockdev.c -index 03e99264dc..9e14feec87 100644 +index 9940116fe0..b113e57d68 100644 --- a/blockdev.c +++ b/blockdev.c -@@ -3056,6 +3056,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, +@@ -3055,6 +3055,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) { return; } diff --git a/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch b/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch index faced44..872496a 100644 --- a/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch +++ b/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch @@ -16,10 +16,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/block/mirror.c b/block/mirror.c -index c688726fae..a7f829f766 100644 +index 4f5f74e2cf..7024f3bbf0 100644 --- a/block/mirror.c +++ b/block/mirror.c -@@ -787,8 +787,8 @@ static int mirror_exit_common(Job *job) +@@ -785,8 +785,8 @@ static int mirror_exit_common(Job *job) job->ret == 0 && ret == 0)) { /* Success; synchronize copy back to sync. */ bdrv_clear_dirty_bitmap(s->sync_bitmap, NULL); @@ -30,7 +30,7 @@ index c688726fae..a7f829f766 100644 } } bdrv_release_dirty_bitmap(s->dirty_bitmap); -@@ -1835,11 +1835,8 @@ static BlockJob *mirror_start_job( +@@ -1843,11 +1843,8 @@ static BlockJob *mirror_start_job( } if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) { 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 3edc237..ca9d5ee 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 @@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht 3 files changed, 70 insertions(+), 59 deletions(-) diff --git a/block/mirror.c b/block/mirror.c -index a7f829f766..6a126d18c8 100644 +index 7024f3bbf0..6211ff22fc 100644 --- a/block/mirror.c +++ b/block/mirror.c -@@ -1635,31 +1635,13 @@ static BlockJob *mirror_start_job( +@@ -1643,31 +1643,13 @@ static BlockJob *mirror_start_job( uint64_t target_perms, target_shared_perms; int ret; @@ -60,10 +60,10 @@ index a7f829f766..6a126d18c8 100644 if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) { diff --git a/blockdev.c b/blockdev.c -index 9e14feec87..b6f797b41f 100644 +index b113e57d68..4be0863050 100644 --- a/blockdev.c +++ b/blockdev.c -@@ -3035,7 +3035,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, +@@ -3034,7 +3034,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, sync = MIRROR_SYNC_MODE_FULL; } diff --git a/debian/patches/extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch b/debian/patches/extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch index 3bc5a4f..1836dff 100644 --- a/debian/patches/extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch +++ b/debian/patches/extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch @@ -48,7 +48,7 @@ Signed-off-by: Thomas Lamprecht 6 files changed, 59 insertions(+), 5 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h -index 1a8a369b50..2c8a558c67 100644 +index 12d395d62d..b182943324 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -16,6 +16,7 @@ extern QemuOptsList qemu_mon_opts; @@ -60,10 +60,10 @@ index 1a8a369b50..2c8a558c67 100644 void monitor_init_globals(void); void monitor_init_globals_core(void); diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h -index 9c3a09cb01..a92be8c3f7 100644 +index 3da3f86c6a..9953e0cd2d 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h -@@ -144,6 +144,13 @@ typedef struct { +@@ -151,6 +151,13 @@ typedef struct { QemuMutex qmp_queue_lock; /* Input queue that holds all the parsed QMP requests */ GQueue *qmp_requests; @@ -78,7 +78,7 @@ index 9c3a09cb01..a92be8c3f7 100644 /** diff --git a/monitor/monitor.c b/monitor/monitor.c -index 46a171bca6..5ccdd2424b 100644 +index 21c7a68758..ad9813567a 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -135,6 +135,21 @@ bool monitor_cur_is_qmp(void) @@ -144,10 +144,10 @@ index 092c527b6f..6b8cfcf6d8 100644 monitor_qmp_caps_reset(mon); data = qmp_greeting(mon); diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c -index 59600210ce..95602446eb 100644 +index d378bccac7..fb8936e7cd 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c -@@ -120,16 +120,28 @@ typedef struct QmpDispatchBH { +@@ -118,16 +118,28 @@ typedef struct QmpDispatchBH { QObject **ret; Error **errp; Coroutine *co; @@ -180,7 +180,7 @@ index 59600210ce..95602446eb 100644 aio_co_wake(data->co); } -@@ -243,6 +255,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, +@@ -232,6 +244,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, .ret = &ret, .errp = &err, .co = qemu_coroutine_self(), diff --git a/debian/patches/extra/0002-monitor-hmp-add-support-for-flag-argument-with-value.patch b/debian/patches/extra/0002-monitor-hmp-add-support-for-flag-argument-with-value.patch index 17df26c..4606c6a 100644 --- a/debian/patches/extra/0002-monitor-hmp-add-support-for-flag-argument-with-value.patch +++ b/debian/patches/extra/0002-monitor-hmp-add-support-for-flag-argument-with-value.patch @@ -18,10 +18,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/monitor/hmp.c b/monitor/hmp.c -index d50c3124e1..a32dce7a35 100644 +index b20737e63c..b29dbb1833 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c -@@ -980,6 +980,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, +@@ -981,6 +981,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, { const char *tmp = p; int skip_key = 0; @@ -29,7 +29,7 @@ index d50c3124e1..a32dce7a35 100644 /* option */ c = *typestr++; -@@ -1002,8 +1003,22 @@ static QDict *monitor_parse_arguments(Monitor *mon, +@@ -1003,8 +1004,22 @@ static QDict *monitor_parse_arguments(Monitor *mon, } if (skip_key) { p = tmp; diff --git a/debian/patches/extra/0003-monitor-refactor-set-expire_password-and-allow-VNC-d.patch b/debian/patches/extra/0003-monitor-refactor-set-expire_password-and-allow-VNC-d.patch index 7f02cf6..e6c8656 100644 --- a/debian/patches/extra/0003-monitor-refactor-set-expire_password-and-allow-VNC-d.patch +++ b/debian/patches/extra/0003-monitor-refactor-set-expire_password-and-allow-VNC-d.patch @@ -24,18 +24,19 @@ Suggested-by: Eric Blake Suggested-by: Markus Armbruster Signed-off-by: Stefan Reiter Signed-off-by: Thomas Lamprecht +Signed-off-by: Fabian Ebner --- - hmp-commands.hx | 29 ++++---- + hmp-commands.hx | 24 ++++--- monitor/hmp-cmds.c | 57 +++++++++++++++- monitor/qmp-cmds.c | 62 ++++++----------- qapi/ui.json | 165 ++++++++++++++++++++++++++++++++++++++------- - 4 files changed, 233 insertions(+), 80 deletions(-) + 4 files changed, 231 insertions(+), 77 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx -index 8e45bce2cd..d78e4cfc47 100644 +index 70a9136ac2..5efb47fc32 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx -@@ -1514,34 +1514,35 @@ ERST +@@ -1514,33 +1514,35 @@ ERST { .name = "set_password", @@ -49,19 +50,16 @@ index 8e45bce2cd..d78e4cfc47 100644 SRST -``set_password [ vnc | spice ] password [ action-if-connected ]`` -- Change spice/vnc password. Use zero to make the password stay valid -- forever. *action-if-connected* specifies what should happen in -- case a connection is established: *fail* makes the password change -- fail. *disconnect* changes the password and disconnects the -- client. *keep* changes the password and keeps the connection up. -- *keep* is the default. +- Change spice/vnc password. *action-if-connected* specifies what +- should happen in case a connection is established: *fail* makes the +- password change fail. *disconnect* changes the password and +``set_password [ vnc | spice ] password [ -d display ] [ action-if-connected ]`` + Change spice/vnc password. *display* can be used with 'vnc' to specify + which display to set the password on. *action-if-connected* specifies + what should happen in case a connection is established: *fail* makes + the password change fail. *disconnect* changes the password and -+ disconnects the client. *keep* changes the password and keeps the -+ connection up. *keep* is the default. + disconnects the client. *keep* changes the password and keeps the + connection up. *keep* is the default. ERST { @@ -86,10 +84,10 @@ index 8e45bce2cd..d78e4cfc47 100644 ``now`` Invalidate password instantly. diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c -index a7e197a90b..f4ef58d257 100644 +index 9c91bf93e9..2e91ccb738 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c -@@ -1451,10 +1451,41 @@ void hmp_set_password(Monitor *mon, const QDict *qdict) +@@ -1384,10 +1384,41 @@ void hmp_set_password(Monitor *mon, const QDict *qdict) { const char *protocol = qdict_get_str(qdict, "protocol"); const char *password = qdict_get_str(qdict, "password"); @@ -132,7 +130,7 @@ index a7e197a90b..f4ef58d257 100644 hmp_handle_error(mon, err); } -@@ -1462,9 +1493,31 @@ void hmp_expire_password(Monitor *mon, const QDict *qdict) +@@ -1395,9 +1426,31 @@ void hmp_expire_password(Monitor *mon, const QDict *qdict) { const char *protocol = qdict_get_str(qdict, "protocol"); const char *whenstr = qdict_get_str(qdict, "time"); @@ -166,10 +164,10 @@ index a7e197a90b..f4ef58d257 100644 } diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c -index f7d64a6457..65882b5997 100644 +index 343353e27a..729ca7cceb 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c -@@ -164,45 +164,30 @@ void qmp_system_wakeup(Error **errp) +@@ -167,45 +167,30 @@ void qmp_system_wakeup(Error **errp) qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, errp); } @@ -231,7 +229,7 @@ index f7d64a6457..65882b5997 100644 } if (rc != 0) { -@@ -210,11 +195,11 @@ void qmp_set_password(const char *protocol, const char *password, +@@ -213,11 +198,11 @@ void qmp_set_password(const char *protocol, const char *password, } } @@ -245,7 +243,7 @@ index f7d64a6457..65882b5997 100644 if (strcmp(whenstr, "now") == 0) { when = 0; -@@ -226,17 +211,14 @@ void qmp_expire_password(const char *protocol, const char *whenstr, +@@ -229,17 +214,14 @@ void qmp_expire_password(const char *protocol, const char *whenstr, when = strtoull(whenstr, NULL, 10); } @@ -268,7 +266,7 @@ index f7d64a6457..65882b5997 100644 if (rc != 0) { diff --git a/qapi/ui.json b/qapi/ui.json -index fd9677d48e..cba8665b73 100644 +index d7567ac866..e49c381145 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -9,22 +9,23 @@ @@ -284,8 +282,8 @@ index fd9677d48e..cba8665b73 100644 +# +## +{ 'enum': 'DisplayProtocol', -+ 'data': [ { 'name': 'vnc', 'if': 'defined(CONFIG_VNC)' }, -+ { 'name': 'spice', 'if': 'defined(CONFIG_SPICE)' } ] } ++ 'data': [ { 'name': 'vnc', 'if': 'CONFIG_VNC' }, ++ { 'name': 'spice', 'if': 'CONFIG_SPICE' } ] } + ## # @set_password: diff --git a/debian/patches/extra/0004-block-mirror-fix-NULL-pointer-dereference-in-mirror_.patch b/debian/patches/extra/0004-block-mirror-fix-NULL-pointer-dereference-in-mirror_.patch deleted file mode 100644 index 74df3e1..0000000 --- a/debian/patches/extra/0004-block-mirror-fix-NULL-pointer-dereference-in-mirror_.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Stefano Garzarella -Date: Fri, 10 Sep 2021 14:45:33 +0200 -Subject: [PATCH] block/mirror: fix NULL pointer dereference in - mirror_wait_on_conflicts() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In mirror_iteration() we call mirror_wait_on_conflicts() with -`self` parameter set to NULL. - -Starting from commit d44dae1a7c we dereference `self` pointer in -mirror_wait_on_conflicts() without checks if it is not NULL. - -Backtrace: - Program terminated with signal SIGSEGV, Segmentation fault. - #0 mirror_wait_on_conflicts (self=0x0, s=, offset=, bytes=) - at ../block/mirror.c:172 - 172 self->waiting_for_op = op; - [Current thread is 1 (Thread 0x7f0908931ec0 (LWP 380249))] - (gdb) bt - #0 mirror_wait_on_conflicts (self=0x0, s=, offset=, bytes=) - at ../block/mirror.c:172 - #1 0x00005610c5d9d631 in mirror_run (job=0x5610c76a2c00, errp=) at ../block/mirror.c:491 - #2 0x00005610c5d58726 in job_co_entry (opaque=0x5610c76a2c00) at ../job.c:917 - #3 0x00005610c5f046c6 in coroutine_trampoline (i0=, i1=) - at ../util/coroutine-ucontext.c:173 - #4 0x00007f0909975820 in ?? () at ../sysdeps/unix/sysv/linux/x86_64/__start_context.S:91 - from /usr/lib64/libc.so.6 - -Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2001404 -Fixes: d44dae1a7c ("block/mirror: fix active mirror dead-lock in mirror_wait_on_conflicts") -Signed-off-by: Stefano Garzarella -Message-Id: <20210910124533.288318-1-sgarzare@redhat.com> -Reviewed-by: Vladimir Sementsov-Ogievskiy -Signed-off-by: Hanna Reitz -(cherry picked from commit 66fed30c9cd11854fc878a4eceb507e915d7c9cd) -Signed-off-by: Fabian Grünbichler -Signed-off-by: Thomas Lamprecht ---- - block/mirror.c | 25 ++++++++++++++++--------- - 1 file changed, 16 insertions(+), 9 deletions(-) - -diff --git a/block/mirror.c b/block/mirror.c -index 98fc66eabf..85b781bc21 100644 ---- a/block/mirror.c -+++ b/block/mirror.c -@@ -160,18 +160,25 @@ static void coroutine_fn mirror_wait_on_conflicts(MirrorOp *self, - if (ranges_overlap(self_start_chunk, self_nb_chunks, - op_start_chunk, op_nb_chunks)) - { -- /* -- * If the operation is already (indirectly) waiting for us, or -- * will wait for us as soon as it wakes up, then just go on -- * (instead of producing a deadlock in the former case). -- */ -- if (op->waiting_for_op) { -- continue; -+ if (self) { -+ /* -+ * If the operation is already (indirectly) waiting for us, -+ * or will wait for us as soon as it wakes up, then just go -+ * on (instead of producing a deadlock in the former case). -+ */ -+ if (op->waiting_for_op) { -+ continue; -+ } -+ -+ self->waiting_for_op = op; - } - -- self->waiting_for_op = op; - qemu_co_queue_wait(&op->waiting_requests, NULL); -- self->waiting_for_op = NULL; -+ -+ if (self) { -+ self->waiting_for_op = NULL; -+ } -+ - break; - } - } diff --git a/debian/patches/extra/0004-block-rbd-fix-handling-of-holes-in-.bdrv_co_block_st.patch b/debian/patches/extra/0004-block-rbd-fix-handling-of-holes-in-.bdrv_co_block_st.patch new file mode 100644 index 0000000..6e38b57 --- /dev/null +++ b/debian/patches/extra/0004-block-rbd-fix-handling-of-holes-in-.bdrv_co_block_st.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Lieven +Date: Thu, 13 Jan 2022 15:44:25 +0100 +Subject: [PATCH] block/rbd: fix handling of holes in .bdrv_co_block_status + +the assumption that we can't hit a hole if we do not diff against a snapshot was wrong. + +We can see a hole in an image if we diff against base if there exists an older snapshot +of the image and we have discarded blocks in the image where the snapshot has data. + +Fix this by simply handling a hole like an unallocated area. There are no callbacks +for unallocated areas so just bail out if we hit a hole. + +Fixes: 0347a8fd4c3faaedf119be04c197804be40a384b +Suggested-by: Ilya Dryomov +Cc: qemu-stable@nongnu.org +Signed-off-by: Peter Lieven +Message-Id: <20220113144426.4036493-2-pl@kamp.de> +Reviewed-by: Ilya Dryomov +Reviewed-by: Stefano Garzarella +Signed-off-by: Kevin Wolf +--- + block/rbd.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/block/rbd.c b/block/rbd.c +index a4b8fb482c..0f34dd0e49 100644 +--- a/block/rbd.c ++++ b/block/rbd.c +@@ -1281,11 +1281,11 @@ static int qemu_rbd_diff_iterate_cb(uint64_t offs, size_t len, + RBDDiffIterateReq *req = opaque; + + assert(req->offs + req->bytes <= offs); +- /* +- * we do not diff against a snapshot so we should never receive a callback +- * for a hole. +- */ +- assert(exists); ++ ++ /* treat a hole like an unallocated area and bail out */ ++ if (!exists) { ++ return 0; ++ } + + if (!req->exists && offs > req->offs) { + /* diff --git a/debian/patches/extra/0005-block-rbd-workaround-for-ceph-issue-53784.patch b/debian/patches/extra/0005-block-rbd-workaround-for-ceph-issue-53784.patch new file mode 100644 index 0000000..ffcaef7 --- /dev/null +++ b/debian/patches/extra/0005-block-rbd-workaround-for-ceph-issue-53784.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Lieven +Date: Thu, 13 Jan 2022 15:44:26 +0100 +Subject: [PATCH] block/rbd: workaround for ceph issue #53784 + +librbd had a bug until early 2022 that affected all versions of ceph that +supported fast-diff. This bug results in reporting of incorrect offsets +if the offset parameter to rbd_diff_iterate2 is not object aligned. + +This patch works around this bug for pre Quincy versions of librbd. + +Fixes: 0347a8fd4c3faaedf119be04c197804be40a384b +Cc: qemu-stable@nongnu.org +Signed-off-by: Peter Lieven +Message-Id: <20220113144426.4036493-3-pl@kamp.de> +Reviewed-by: Ilya Dryomov +Reviewed-by: Stefano Garzarella +Tested-by: Stefano Garzarella +Signed-off-by: Kevin Wolf +--- + block/rbd.c | 42 ++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 40 insertions(+), 2 deletions(-) + +diff --git a/block/rbd.c b/block/rbd.c +index 0f34dd0e49..458f6bd7eb 100644 +--- a/block/rbd.c ++++ b/block/rbd.c +@@ -1322,6 +1322,7 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs, + int status, r; + RBDDiffIterateReq req = { .offs = offset }; + uint64_t features, flags; ++ uint64_t head = 0; + + assert(offset + bytes <= s->image_size); + +@@ -1349,7 +1350,43 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs, + return status; + } + +- r = rbd_diff_iterate2(s->image, NULL, offset, bytes, true, true, ++#if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 17, 0) ++ /* ++ * librbd had a bug until early 2022 that affected all versions of ceph that ++ * supported fast-diff. This bug results in reporting of incorrect offsets ++ * if the offset parameter to rbd_diff_iterate2 is not object aligned. ++ * Work around this bug by rounding down the offset to object boundaries. ++ * This is OK because we call rbd_diff_iterate2 with whole_object = true. ++ * However, this workaround only works for non cloned images with default ++ * striping. ++ * ++ * See: https://tracker.ceph.com/issues/53784 ++ */ ++ ++ /* check if RBD image has non-default striping enabled */ ++ if (features & RBD_FEATURE_STRIPINGV2) { ++ return status; ++ } ++ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" ++ /* ++ * check if RBD image is a clone (= has a parent). ++ * ++ * rbd_get_parent_info is deprecated from Nautilus onwards, but the ++ * replacement rbd_get_parent is not present in Luminous and Mimic. ++ */ ++ if (rbd_get_parent_info(s->image, NULL, 0, NULL, 0, NULL, 0) != -ENOENT) { ++ return status; ++ } ++#pragma GCC diagnostic pop ++ ++ head = req.offs & (s->object_size - 1); ++ req.offs -= head; ++ bytes += head; ++#endif ++ ++ r = rbd_diff_iterate2(s->image, NULL, req.offs, bytes, true, true, + qemu_rbd_diff_iterate_cb, &req); + if (r < 0 && r != QEMU_RBD_EXIT_DIFF_ITERATE2) { + return status; +@@ -1368,7 +1405,8 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs, + status = BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID; + } + +- *pnum = req.bytes; ++ assert(req.bytes > head); ++ *pnum = req.bytes - head; + return status; + } + diff --git a/debian/patches/extra/0006-block-io-Update-BSC-only-if-want_zero-is-true.patch b/debian/patches/extra/0006-block-io-Update-BSC-only-if-want_zero-is-true.patch new file mode 100644 index 0000000..b8b1025 --- /dev/null +++ b/debian/patches/extra/0006-block-io-Update-BSC-only-if-want_zero-is-true.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hanna Reitz +Date: Tue, 18 Jan 2022 17:59:59 +0100 +Subject: [PATCH] block/io: Update BSC only if want_zero is true + +We update the block-status cache whenever we get new information from a +bdrv_co_block_status() call to the block driver. However, if we have +passed want_zero=false to that call, it may flag areas containing zeroes +as data, and so we would update the block-status cache with wrong +information. + +Therefore, we should not update the cache with want_zero=false. + +Reported-by: Nir Soffer +Fixes: 0bc329fbb00 ("block: block-status cache for data regions") +Reviewed-by: Nir Soffer +Cc: qemu-stable@nongnu.org +Signed-off-by: Hanna Reitz +Message-Id: <20220118170000.49423-2-hreitz@redhat.com> +Reviewed-by: Eric Blake +Signed-off-by: Eric Blake +--- + block/io.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/block/io.c b/block/io.c +index 8c14e090d7..04061f1e68 100644 +--- a/block/io.c ++++ b/block/io.c +@@ -2501,8 +2501,12 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs, + * non-protocol nodes, and then it is never used. However, filling + * the cache requires an RCU update, so double check here to avoid + * such an update if possible. ++ * ++ * Check want_zero, because we only want to update the cache when we ++ * have accurate information about what is zero and what is data. + */ +- if (ret == (BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID) && ++ if (want_zero && ++ ret == (BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID) && + QLIST_EMPTY(&bs->children)) + { + /* diff --git a/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch index 5d8cb96..ae9a483 100644 --- a/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch +++ b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch @@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c -index dd295cfc6d..3ac5177cbb 100644 +index b283093e5b..821405fd02 100644 --- a/block/file-posix.c +++ b/block/file-posix.c -@@ -533,7 +533,7 @@ static QemuOptsList raw_runtime_opts = { +@@ -552,7 +552,7 @@ static QemuOptsList raw_runtime_opts = { { .name = "locking", .type = QEMU_OPT_STRING, @@ -26,7 +26,7 @@ index dd295cfc6d..3ac5177cbb 100644 }, { .name = "pr-manager", -@@ -631,7 +631,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, +@@ -652,7 +652,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, s->use_lock = false; break; case ON_OFF_AUTO_AUTO: diff --git a/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch index 7d1db09..9647ea5 100644 --- a/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch +++ b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch @@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/net.h b/include/net/net.h -index 5d1508081f..f665924193 100644 +index 523136c7ac..c27859b4f6 100644 --- a/include/net/net.h +++ b/include/net/net.h -@@ -219,8 +219,8 @@ void netdev_add(QemuOpts *opts, Error **errp); +@@ -226,8 +226,8 @@ void netdev_add(QemuOpts *opts, Error **errp); int net_hub_id_for_client(NetClientState *nc, int *id); NetClientState *net_hub_port_find(int hub_id); diff --git a/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch b/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch index 34d875f..051e997 100644 --- a/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch +++ b/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch @@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h -index 21b33fbe2e..32514193a9 100644 +index 04f2b790c9..19fdbb981c 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h -@@ -2007,9 +2007,9 @@ uint64_t cpu_get_tsc(CPUX86State *env); +@@ -2039,9 +2039,9 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define CPU_RESOLVING_TYPE TYPE_X86_CPU #ifdef TARGET_X86_64 @@ -24,4 +24,4 @@ index 21b33fbe2e..32514193a9 100644 +#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("kvm32") #endif - #define cpu_signal_handler cpu_x86_signal_handler + #define cpu_list x86_cpu_list diff --git a/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch b/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch index 8301222..0e41fd1 100644 --- a/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch +++ b/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch @@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/spice-core.c b/ui/spice-core.c -index 0371055e6c..840cf56923 100644 +index 31974b8d6c..a3acdbd682 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c -@@ -694,32 +694,35 @@ static void qemu_spice_init(void) +@@ -689,32 +689,35 @@ static void qemu_spice_init(void) if (tls_port) { x509_dir = qemu_opt_get(opts, "x509-dir"); diff --git a/debian/patches/pve/0005-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch b/debian/patches/pve/0005-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch index cec81b1..fd4934c 100644 --- a/debian/patches/pve/0005-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch +++ b/debian/patches/pve/0005-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch @@ -9,7 +9,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/block/gluster.c b/block/gluster.c -index e8ee14c8e9..3eb6a05500 100644 +index 398976bc66..523304835e 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -42,7 +42,7 @@ diff --git a/debian/patches/pve/0006-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch b/debian/patches/pve/0006-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch index 130f3b4..e378405 100644 --- a/debian/patches/pve/0006-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch +++ b/debian/patches/pve/0006-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch @@ -18,10 +18,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 2 insertions(+) diff --git a/block/rbd.c b/block/rbd.c -index dcf82b15b8..feeec452f0 100644 +index def96292e0..a4b8fb482c 100644 --- a/block/rbd.c +++ b/block/rbd.c -@@ -814,6 +814,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx, +@@ -820,6 +820,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx, rados_conf_set(*cluster, "rbd_cache", "false"); } diff --git a/debian/patches/pve/0007-PVE-Up-qmp-add-get_link_status.patch b/debian/patches/pve/0007-PVE-Up-qmp-add-get_link_status.patch index 74aa242..ac54142 100644 --- a/debian/patches/pve/0007-PVE-Up-qmp-add-get_link_status.patch +++ b/debian/patches/pve/0007-PVE-Up-qmp-add-get_link_status.patch @@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht 3 files changed, 43 insertions(+) diff --git a/net/net.c b/net/net.c -index 76bbb7c31b..82e0a768b4 100644 +index f0d14dbfc1..6d476c47ef 100644 --- a/net/net.c +++ b/net/net.c -@@ -1314,6 +1314,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) +@@ -1334,6 +1334,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) } } diff --git a/debian/patches/pve/0008-PVE-Up-glusterfs-allow-partial-reads.patch b/debian/patches/pve/0008-PVE-Up-glusterfs-allow-partial-reads.patch index a0fdc22..adc5bae 100644 --- a/debian/patches/pve/0008-PVE-Up-glusterfs-allow-partial-reads.patch +++ b/debian/patches/pve/0008-PVE-Up-glusterfs-allow-partial-reads.patch @@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/block/gluster.c b/block/gluster.c -index 3eb6a05500..b612918ee8 100644 +index 523304835e..80b75cb96c 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -57,6 +57,7 @@ typedef struct GlusterAIOCB { @@ -39,15 +39,15 @@ index 3eb6a05500..b612918ee8 100644 } aio_co_schedule(acb->aio_context, acb->coroutine); -@@ -1021,6 +1024,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, +@@ -1022,6 +1025,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, acb.ret = 0; acb.coroutine = qemu_coroutine_self(); acb.aio_context = bdrv_get_aio_context(bs); + acb.is_write = true; - ret = glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb, &acb); + ret = glfs_zerofill_async(s->fd, offset, bytes, gluster_finish_aiocb, &acb); if (ret < 0) { -@@ -1202,9 +1206,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs, +@@ -1203,9 +1207,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs, acb.aio_context = bdrv_get_aio_context(bs); if (write) { @@ -59,7 +59,7 @@ index 3eb6a05500..b612918ee8 100644 ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0, gluster_finish_aiocb, &acb); } -@@ -1268,6 +1274,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs) +@@ -1269,6 +1275,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs) acb.ret = 0; acb.coroutine = qemu_coroutine_self(); acb.aio_context = bdrv_get_aio_context(bs); @@ -67,11 +67,11 @@ index 3eb6a05500..b612918ee8 100644 ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb); if (ret < 0) { -@@ -1314,6 +1321,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs, +@@ -1317,6 +1324,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs, acb.ret = 0; acb.coroutine = qemu_coroutine_self(); acb.aio_context = bdrv_get_aio_context(bs); + acb.is_write = true; - ret = glfs_discard_async(s->fd, offset, size, gluster_finish_aiocb, &acb); + ret = glfs_discard_async(s->fd, offset, bytes, gluster_finish_aiocb, &acb); if (ret < 0) { diff --git a/debian/patches/pve/0009-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch b/debian/patches/pve/0009-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch index ab15fd0..58f04c8 100644 --- a/debian/patches/pve/0009-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch +++ b/debian/patches/pve/0009-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch @@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c -index 908fd0cce5..5dc1d0a2ca 100644 +index f036a1d428..080ad9bca7 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -2977,7 +2977,8 @@ static int img_info(int argc, char **argv) +@@ -2989,7 +2989,8 @@ static int img_info(int argc, char **argv) list = collect_image_info_list(image_opts, filename, fmt, chain, force_share); if (!list) { diff --git a/debian/patches/pve/0010-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch b/debian/patches/pve/0010-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch index e4a92ab..ddd3743 100644 --- a/debian/patches/pve/0010-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch +++ b/debian/patches/pve/0010-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch @@ -37,7 +37,7 @@ Signed-off-by: Thomas Lamprecht 2 files changed, 119 insertions(+), 72 deletions(-) diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx -index b3620f29e5..e70ef3dc91 100644 +index 72bcdcfbfa..0b2999f3ab 100644 --- a/qemu-img-cmds.hx +++ b/qemu-img-cmds.hx @@ -58,9 +58,9 @@ SRST @@ -53,10 +53,10 @@ index b3620f29e5..e70ef3dc91 100644 DEF("info", img_info, diff --git a/qemu-img.c b/qemu-img.c -index 5dc1d0a2ca..f773182bd0 100644 +index 080ad9bca7..1f457d9e80 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4793,10 +4793,12 @@ static int img_bitmap(int argc, char **argv) +@@ -4805,10 +4805,12 @@ static int img_bitmap(int argc, char **argv) #define C_IF 04 #define C_OF 010 #define C_SKIP 020 @@ -69,7 +69,7 @@ index 5dc1d0a2ca..f773182bd0 100644 }; struct DdIo { -@@ -4872,6 +4874,19 @@ static int img_dd_skip(const char *arg, +@@ -4884,6 +4886,19 @@ static int img_dd_skip(const char *arg, return 0; } @@ -89,7 +89,7 @@ index 5dc1d0a2ca..f773182bd0 100644 static int img_dd(int argc, char **argv) { int ret = 0; -@@ -4912,6 +4927,7 @@ static int img_dd(int argc, char **argv) +@@ -4924,6 +4939,7 @@ static int img_dd(int argc, char **argv) { "if", img_dd_if, C_IF }, { "of", img_dd_of, C_OF }, { "skip", img_dd_skip, C_SKIP }, @@ -97,7 +97,7 @@ index 5dc1d0a2ca..f773182bd0 100644 { NULL, NULL, 0 } }; const struct option long_options[] = { -@@ -4987,91 +5003,112 @@ static int img_dd(int argc, char **argv) +@@ -4999,91 +5015,112 @@ static int img_dd(int argc, char **argv) arg = NULL; } @@ -274,7 +274,7 @@ index 5dc1d0a2ca..f773182bd0 100644 } if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz || -@@ -5089,11 +5126,17 @@ static int img_dd(int argc, char **argv) +@@ -5101,11 +5138,17 @@ static int img_dd(int argc, char **argv) for (out_pos = 0; in_pos < size; block_count++) { int in_ret, out_ret; @@ -296,7 +296,7 @@ index 5dc1d0a2ca..f773182bd0 100644 } if (in_ret < 0) { error_report("error while reading from input image file: %s", -@@ -5103,9 +5146,13 @@ static int img_dd(int argc, char **argv) +@@ -5115,9 +5158,13 @@ static int img_dd(int argc, char **argv) } in_pos += in_ret; diff --git a/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-isize-parameter.patch b/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-isize-parameter.patch index 16684ab..3e4434f 100644 --- a/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-isize-parameter.patch +++ b/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-isize-parameter.patch @@ -15,10 +15,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu-img.c -index f773182bd0..98a6562364 100644 +index 1f457d9e80..d9e8a8c4d4 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4794,11 +4794,13 @@ static int img_bitmap(int argc, char **argv) +@@ -4806,11 +4806,13 @@ static int img_bitmap(int argc, char **argv) #define C_OF 010 #define C_SKIP 020 #define C_OSIZE 040 @@ -32,7 +32,7 @@ index f773182bd0..98a6562364 100644 }; struct DdIo { -@@ -4887,6 +4889,19 @@ static int img_dd_osize(const char *arg, +@@ -4899,6 +4901,19 @@ static int img_dd_osize(const char *arg, return 0; } @@ -52,7 +52,7 @@ index f773182bd0..98a6562364 100644 static int img_dd(int argc, char **argv) { int ret = 0; -@@ -4901,12 +4916,14 @@ static int img_dd(int argc, char **argv) +@@ -4913,12 +4928,14 @@ static int img_dd(int argc, char **argv) int c, i; const char *out_fmt = "raw"; const char *fmt = NULL; @@ -68,7 +68,7 @@ index f773182bd0..98a6562364 100644 }; struct DdIo in = { .bsz = 512, /* Block size is by default 512 bytes */ -@@ -4928,6 +4945,7 @@ static int img_dd(int argc, char **argv) +@@ -4940,6 +4957,7 @@ static int img_dd(int argc, char **argv) { "of", img_dd_of, C_OF }, { "skip", img_dd_skip, C_SKIP }, { "osize", img_dd_osize, C_OSIZE }, @@ -76,7 +76,7 @@ index f773182bd0..98a6562364 100644 { NULL, NULL, 0 } }; const struct option long_options[] = { -@@ -5124,14 +5142,18 @@ static int img_dd(int argc, char **argv) +@@ -5136,14 +5154,18 @@ static int img_dd(int argc, char **argv) in.buf = g_new(uint8_t, in.bsz); diff --git a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch index 3da9e02..7a86db2 100644 --- a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch +++ b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch @@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/qemu-img.c b/qemu-img.c -index 98a6562364..355b3b82f4 100644 +index d9e8a8c4d4..6e1fbd5820 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4918,7 +4918,7 @@ static int img_dd(int argc, char **argv) +@@ -4930,7 +4930,7 @@ static int img_dd(int argc, char **argv) const char *fmt = NULL; int64_t size = 0, readsize = 0; int64_t block_count = 0, out_pos, in_pos; @@ -21,7 +21,7 @@ index 98a6562364..355b3b82f4 100644 struct DdInfo dd = { .flags = 0, .count = 0, -@@ -4956,7 +4956,7 @@ static int img_dd(int argc, char **argv) +@@ -4968,7 +4968,7 @@ static int img_dd(int argc, char **argv) { 0, 0, 0, 0 } }; @@ -30,7 +30,7 @@ index 98a6562364..355b3b82f4 100644 if (c == EOF) { break; } -@@ -4976,6 +4976,9 @@ static int img_dd(int argc, char **argv) +@@ -4988,6 +4988,9 @@ static int img_dd(int argc, char **argv) case 'h': help(); break; @@ -40,7 +40,7 @@ index 98a6562364..355b3b82f4 100644 case 'U': force_share = true; break; -@@ -5106,13 +5109,15 @@ static int img_dd(int argc, char **argv) +@@ -5118,13 +5121,15 @@ static int img_dd(int argc, char **argv) size - in.bsz * in.offset, &error_abort); } diff --git a/debian/patches/pve/0013-PVE-virtio-balloon-improve-query-balloon.patch b/debian/patches/pve/0013-PVE-virtio-balloon-improve-query-balloon.patch index caa50a1..88a9785 100644 --- a/debian/patches/pve/0013-PVE-virtio-balloon-improve-query-balloon.patch +++ b/debian/patches/pve/0013-PVE-virtio-balloon-improve-query-balloon.patch @@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c -index ae7867a8db..956e3f4e46 100644 +index 9a4f491b54..1faa16234e 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c -@@ -820,8 +820,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f, +@@ -812,8 +812,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f, static void virtio_balloon_stat(void *opaque, BalloonInfo *info) { VirtIOBalloon *dev = opaque; @@ -58,10 +58,10 @@ index ae7867a8db..956e3f4e46 100644 static void virtio_balloon_to_target(void *opaque, ram_addr_t target) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c -index f4ef58d257..c8b97909e7 100644 +index 2e91ccb738..e9fa9af6bd 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c -@@ -698,7 +698,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict) +@@ -696,7 +696,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict) return; } @@ -99,7 +99,7 @@ index f4ef58d257..c8b97909e7 100644 qapi_free_BalloonInfo(info); } diff --git a/qapi/machine.json b/qapi/machine.json -index 157712f006..34035c25d1 100644 +index 067e3f5378..91f3be6f44 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1018,10 +1018,30 @@ diff --git a/debian/patches/pve/0014-PVE-qapi-modify-query-machines.patch b/debian/patches/pve/0014-PVE-qapi-modify-query-machines.patch index 9b4eca6..a7dfb1d 100644 --- a/debian/patches/pve/0014-PVE-qapi-modify-query-machines.patch +++ b/debian/patches/pve/0014-PVE-qapi-modify-query-machines.patch @@ -13,10 +13,10 @@ Signed-off-by: Dietmar Maurer 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c -index 216fdfaf3a..8f8d5d5276 100644 +index 4f4ab30f8c..76fff60a6b 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c -@@ -98,6 +98,12 @@ MachineInfoList *qmp_query_machines(Error **errp) +@@ -99,6 +99,12 @@ MachineInfoList *qmp_query_machines(Error **errp) info->hotpluggable_cpus = mc->has_hotpluggable_cpus; info->numa_mem_supported = mc->numa_mem_supported; info->deprecated = !!mc->deprecation_reason; @@ -30,7 +30,7 @@ index 216fdfaf3a..8f8d5d5276 100644 info->default_cpu_type = g_strdup(mc->default_cpu_type); info->has_default_cpu_type = true; diff --git a/qapi/machine.json b/qapi/machine.json -index 34035c25d1..cf120ac343 100644 +index 91f3be6f44..0905618e25 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -141,6 +141,8 @@ diff --git a/debian/patches/pve/0015-PVE-qapi-modify-spice-query.patch b/debian/patches/pve/0015-PVE-qapi-modify-spice-query.patch index 32d06b3..f65fb57 100644 --- a/debian/patches/pve/0015-PVE-qapi-modify-spice-query.patch +++ b/debian/patches/pve/0015-PVE-qapi-modify-spice-query.patch @@ -12,7 +12,7 @@ Signed-off-by: Thomas Lamprecht 2 files changed, 8 insertions(+) diff --git a/qapi/ui.json b/qapi/ui.json -index cba8665b73..081115ea8a 100644 +index e49c381145..28a1797247 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -333,11 +333,14 @@ @@ -28,10 +28,10 @@ index cba8665b73..081115ea8a 100644 '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str', + '*ticket': 'str', 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']}, - 'if': 'defined(CONFIG_SPICE)' } + 'if': 'CONFIG_SPICE' } diff --git a/ui/spice-core.c b/ui/spice-core.c -index 840cf56923..96be349635 100644 +index a3acdbd682..756776778d 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -534,6 +534,11 @@ static SpiceInfo *qmp_query_spice_real(Error **errp) diff --git a/debian/patches/pve/0016-PVE-add-savevm-async-for-background-state-snapshots.patch b/debian/patches/pve/0016-PVE-add-savevm-async-for-background-state-snapshots.patch index 8b6ebcb..365e481 100644 --- a/debian/patches/pve/0016-PVE-add-savevm-async-for-background-state-snapshots.patch +++ b/debian/patches/pve/0016-PVE-add-savevm-async-for-background-state-snapshots.patch @@ -39,10 +39,10 @@ Signed-off-by: Stefan Reiter create mode 100644 migration/savevm-async.c diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx -index 27206ac049..e6dd3be07a 100644 +index 407a1da800..245f8acc55 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx -@@ -551,6 +551,19 @@ SRST +@@ -536,6 +536,19 @@ SRST Show current migration parameters. ERST @@ -63,11 +63,11 @@ index 27206ac049..e6dd3be07a 100644 .name = "balloon", .args_type = "", diff --git a/hmp-commands.hx b/hmp-commands.hx -index d78e4cfc47..42203dbe92 100644 +index 5efb47fc32..1ad13b668b 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx -@@ -1744,3 +1744,36 @@ ERST - .help = "start a round of guest dirty rate measurement", +@@ -1746,3 +1746,36 @@ ERST + "\n\t\t\t -b to specify dirty bitmap as method of calculation)", .cmd = hmp_calc_dirty_rate, }, + @@ -115,10 +115,10 @@ index e72083b117..c846d37806 100644 + #endif diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h -index 3baa1058e2..1247d7362a 100644 +index 96d014826a..3a39ba41b5 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h -@@ -25,6 +25,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict); +@@ -26,6 +26,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict); void hmp_info_uuid(Monitor *mon, const QDict *qdict); void hmp_info_chardev(Monitor *mon, const QDict *qdict); void hmp_info_mice(Monitor *mon, const QDict *qdict); @@ -126,7 +126,7 @@ index 3baa1058e2..1247d7362a 100644 void hmp_info_migrate(Monitor *mon, const QDict *qdict); void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict); -@@ -79,6 +80,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict); +@@ -80,6 +81,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict); void hmp_netdev_del(Monitor *mon, const QDict *qdict); void hmp_getfd(Monitor *mon, const QDict *qdict); void hmp_closefd(Monitor *mon, const QDict *qdict); @@ -754,10 +754,10 @@ index 0000000000..79a0cda906 + return ret; +} diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c -index c8b97909e7..64a84cf4ee 100644 +index e9fa9af6bd..5000ce39d1 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c -@@ -1961,6 +1961,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) +@@ -1903,6 +1903,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } @@ -822,7 +822,7 @@ index c8b97909e7..64a84cf4ee 100644 { IOThreadInfoList *info_list = qmp_query_iothreads(NULL); diff --git a/qapi/migration.json b/qapi/migration.json -index 1124a2dda8..3d72b3e3f3 100644 +index bbfd48cf0b..45686390a2 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -247,6 +247,40 @@ @@ -867,10 +867,10 @@ index 1124a2dda8..3d72b3e3f3 100644 # @query-migrate: # diff --git a/qapi/misc.json b/qapi/misc.json -index 5c2ca3b556..9bc14e1032 100644 +index 358548abe1..25b3febc52 100644 --- a/qapi/misc.json +++ b/qapi/misc.json -@@ -431,6 +431,38 @@ +@@ -435,6 +435,38 @@ ## { 'command': 'query-fdsets', 'returns': ['FdsetInfo'] } @@ -910,10 +910,10 @@ index 5c2ca3b556..9bc14e1032 100644 # @CommandLineParameterType: # diff --git a/qemu-options.hx b/qemu-options.hx -index 83aa59a920..002ba697e9 100644 +index ae2c6dbbfc..423144abeb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx -@@ -4131,6 +4131,18 @@ SRST +@@ -4171,6 +4171,18 @@ SRST Start right away with a saved state (``loadvm`` in monitor) ERST @@ -933,21 +933,21 @@ index 83aa59a920..002ba697e9 100644 DEF("daemonize", 0, QEMU_OPTION_daemonize, \ "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL) diff --git a/softmmu/vl.c b/softmmu/vl.c -index 5ca11e7469..220c67cd32 100644 +index 620a1f1367..fd82efb8b3 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c -@@ -150,6 +150,7 @@ static const char *incoming; +@@ -156,6 +156,7 @@ static const char *incoming; static const char *loadvm; static const char *accelerators; static QDict *machine_opts_dict; +static const char *loadstate; static QTAILQ_HEAD(, ObjectOption) object_opts = QTAILQ_HEAD_INITIALIZER(object_opts); + static QTAILQ_HEAD(, DeviceOption) device_opts = QTAILQ_HEAD_INITIALIZER(device_opts); static ram_addr_t maxram_size; - static uint64_t ram_slots; -@@ -2700,6 +2701,12 @@ void qmp_x_exit_preconfig(Error **errp) - autostart = 0; - exit(1); - } +@@ -2743,6 +2744,12 @@ void qmp_x_exit_preconfig(Error **errp) + + if (loadvm) { + load_snapshot(loadvm, NULL, false, NULL, &error_fatal); + } else if (loadstate) { + Error *local_err = NULL; + if (load_snapshot_from_blockdev(loadstate, &local_err) < 0) { @@ -957,7 +957,7 @@ index 5ca11e7469..220c67cd32 100644 } if (replay_mode != REPLAY_MODE_NONE) { replay_vmstate_init(); -@@ -3238,6 +3245,9 @@ void qemu_init(int argc, char **argv, char **envp) +@@ -3284,6 +3291,9 @@ void qemu_init(int argc, char **argv, char **envp) case QEMU_OPTION_loadvm: loadvm = optarg; break; diff --git a/debian/patches/pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch b/debian/patches/pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch index 6e99955..9a17710 100644 --- a/debian/patches/pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch +++ b/debian/patches/pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch @@ -4,6 +4,8 @@ Date: Mon, 6 Apr 2020 12:16:47 +0200 Subject: [PATCH] PVE: block: add the zeroinit block driver filter Signed-off-by: Thomas Lamprecht +[adapt to changed function signatures] +Signed-off-by: Fabian Ebner --- block/meson.build | 1 + block/zeroinit.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++ @@ -11,7 +13,7 @@ Signed-off-by: Thomas Lamprecht create mode 100644 block/zeroinit.c diff --git a/block/meson.build b/block/meson.build -index 0450914c7a..7a0bc3df09 100644 +index deb73ca389..c9d1fdca7d 100644 --- a/block/meson.build +++ b/block/meson.build @@ -41,6 +41,7 @@ block_ss.add(files( @@ -24,7 +26,7 @@ index 0450914c7a..7a0bc3df09 100644 softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c')) diff --git a/block/zeroinit.c b/block/zeroinit.c new file mode 100644 -index 0000000000..5529627f7e +index 0000000000..20ee611f22 --- /dev/null +++ b/block/zeroinit.c @@ -0,0 +1,196 @@ @@ -138,22 +140,22 @@ index 0000000000..5529627f7e +} + +static int coroutine_fn zeroinit_co_preadv(BlockDriverState *bs, -+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) ++ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) +{ + return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags); +} + +static int coroutine_fn zeroinit_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, -+ int count, BdrvRequestFlags flags) ++ int64_t bytes, BdrvRequestFlags flags) +{ + BDRVZeroinitState *s = bs->opaque; + if (offset >= s->extents) + return 0; -+ return bdrv_pwrite_zeroes(bs->file, offset, count, flags); ++ return bdrv_pwrite_zeroes(bs->file, offset, bytes, flags); +} + +static int coroutine_fn zeroinit_co_pwritev(BlockDriverState *bs, -+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) ++ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) +{ + BDRVZeroinitState *s = bs->opaque; + int64_t extents = offset + bytes; @@ -174,9 +176,9 @@ index 0000000000..5529627f7e +} + +static int coroutine_fn zeroinit_co_pdiscard(BlockDriverState *bs, -+ int64_t offset, int count) ++ int64_t offset, int64_t bytes) +{ -+ return bdrv_co_pdiscard(bs->file, offset, count); ++ return bdrv_co_pdiscard(bs->file, offset, bytes); +} + +static int zeroinit_co_truncate(BlockDriverState *bs, int64_t offset, diff --git a/debian/patches/pve/0019-PVE-Add-dummy-id-command-line-parameter.patch b/debian/patches/pve/0019-PVE-Add-dummy-id-command-line-parameter.patch index b346224..be8407b 100644 --- a/debian/patches/pve/0019-PVE-Add-dummy-id-command-line-parameter.patch +++ b/debian/patches/pve/0019-PVE-Add-dummy-id-command-line-parameter.patch @@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht 2 files changed, 11 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx -index 002ba697e9..a05959b9f1 100644 +index 423144abeb..4879471aeb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx -@@ -1005,6 +1005,9 @@ DEFHEADING() +@@ -1019,6 +1019,9 @@ DEFHEADING() DEFHEADING(Block device options:) @@ -28,10 +28,10 @@ index 002ba697e9..a05959b9f1 100644 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL) DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL) diff --git a/softmmu/vl.c b/softmmu/vl.c -index 220c67cd32..d87cf6e103 100644 +index fd82efb8b3..eb05e5a000 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c -@@ -2736,6 +2736,7 @@ void qemu_init(int argc, char **argv, char **envp) +@@ -2779,6 +2779,7 @@ void qemu_init(int argc, char **argv, char **envp) MachineClass *machine_class; bool userconfig = true; FILE *vmstate_dump_file = NULL; @@ -39,9 +39,9 @@ index 220c67cd32..d87cf6e103 100644 qemu_add_opts(&qemu_drive_opts); qemu_add_drive_opts(&qemu_legacy_drive_opts); -@@ -3360,6 +3361,13 @@ void qemu_init(int argc, char **argv, char **envp) - case QEMU_OPTION_smp: - machine_parse_property_opt(qemu_find_opts("smp-opts"), "smp", optarg, &error_fatal); +@@ -3421,6 +3422,13 @@ void qemu_init(int argc, char **argv, char **envp) + machine_parse_property_opt(qemu_find_opts("smp-opts"), + "smp", optarg); break; + case QEMU_OPTION_id: + vm_id = strtol(optarg, (char **)&optarg, 10); diff --git a/debian/patches/pve/0021-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch b/debian/patches/pve/0021-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch index afa0b0e..5f1838c 100644 --- a/debian/patches/pve/0021-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch +++ b/debian/patches/pve/0021-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch @@ -13,10 +13,10 @@ Signed-off-by: Thomas Lamprecht 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c -index 3ac5177cbb..907aa3f22e 100644 +index 821405fd02..e3b6c3c524 100644 --- a/block/file-posix.c +++ b/block/file-posix.c -@@ -2443,6 +2443,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) +@@ -2465,6 +2465,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) int fd; uint64_t perm, shared; int result = 0; @@ -24,7 +24,7 @@ index 3ac5177cbb..907aa3f22e 100644 /* Validate options and set default values */ assert(options->driver == BLOCKDEV_DRIVER_FILE); -@@ -2483,19 +2484,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) +@@ -2505,19 +2506,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) perm = BLK_PERM_WRITE | BLK_PERM_RESIZE; shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE; @@ -59,7 +59,7 @@ index 3ac5177cbb..907aa3f22e 100644 } /* Clear the file by truncating it to 0 */ -@@ -2549,13 +2553,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) +@@ -2571,13 +2575,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) } out_unlock: @@ -82,7 +82,7 @@ index 3ac5177cbb..907aa3f22e 100644 } out_close: -@@ -2580,6 +2586,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv, +@@ -2602,6 +2608,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv, PreallocMode prealloc; char *buf = NULL; Error *local_err = NULL; @@ -90,7 +90,7 @@ index 3ac5177cbb..907aa3f22e 100644 /* Skip file: protocol prefix */ strstart(filename, "file:", &filename); -@@ -2602,6 +2609,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv, +@@ -2624,6 +2631,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv, return -EINVAL; } @@ -109,7 +109,7 @@ index 3ac5177cbb..907aa3f22e 100644 options = (BlockdevCreateOptions) { .driver = BLOCKDEV_DRIVER_FILE, .u.file = { -@@ -2613,6 +2632,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv, +@@ -2635,6 +2654,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv, .nocow = nocow, .has_extent_size_hint = has_extent_size_hint, .extent_size_hint = extent_size_hint, @@ -119,10 +119,10 @@ index 3ac5177cbb..907aa3f22e 100644 }; return raw_co_create(&options, errp); diff --git a/qapi/block-core.json b/qapi/block-core.json -index 6356a63695..fdfa579d00 100644 +index da5dca1e3b..cd69af921e 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -4341,7 +4341,8 @@ +@@ -4466,7 +4466,8 @@ 'size': 'size', '*preallocation': 'PreallocMode', '*nocow': 'bool', diff --git a/debian/patches/pve/0023-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch b/debian/patches/pve/0023-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch index ff9f43c..867084d 100644 --- a/debian/patches/pve/0023-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch +++ b/debian/patches/pve/0023-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch @@ -26,10 +26,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c -index 2cf2f321f9..e0f857820d 100644 +index 53a99abc56..ad2cb2592e 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c -@@ -107,7 +107,8 @@ GlobalProperty hw_compat_4_0[] = { +@@ -113,7 +113,8 @@ GlobalProperty hw_compat_4_0[] = { { "virtio-vga", "edid", "false" }, { "virtio-gpu-device", "edid", "false" }, { "virtio-device", "use-started", "false" }, diff --git a/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch b/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch index e699c7d..5656e1f 100644 --- a/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch +++ b/debian/patches/pve/0024-PVE-Allow-version-code-in-machine-type.patch @@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c -index 8f8d5d5276..370e66d9cc 100644 +index 76fff60a6b..ec9201fb9a 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c -@@ -102,6 +102,12 @@ MachineInfoList *qmp_query_machines(Error **errp) +@@ -103,6 +103,12 @@ MachineInfoList *qmp_query_machines(Error **errp) if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) { info->has_is_current = true; info->is_current = true; @@ -36,10 +36,10 @@ index 8f8d5d5276..370e66d9cc 100644 if (mc->default_cpu_type) { diff --git a/include/hw/boards.h b/include/hw/boards.h -index accd6eff35..1b16728389 100644 +index 9c1c190104..51e04bde62 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h -@@ -205,6 +205,8 @@ struct MachineClass { +@@ -227,6 +227,8 @@ struct MachineClass { const char *desc; const char *deprecation_reason; @@ -49,7 +49,7 @@ index accd6eff35..1b16728389 100644 void (*reset)(MachineState *state); void (*wakeup)(MachineState *state); diff --git a/qapi/machine.json b/qapi/machine.json -index cf120ac343..a6f483af4f 100644 +index 0905618e25..a05c46e253 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -160,6 +160,8 @@ @@ -71,10 +71,10 @@ index cf120ac343..a6f483af4f 100644 ## # @query-machines: diff --git a/softmmu/vl.c b/softmmu/vl.c -index d87cf6e103..e9d40065bc 100644 +index eb05e5a000..f306d21d63 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c -@@ -1621,6 +1621,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv, +@@ -1655,6 +1655,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv, static MachineClass *select_machine(QDict *qdict, Error **errp) { const char *optarg = qdict_get_try_str(qdict, "type"); @@ -82,7 +82,7 @@ index d87cf6e103..e9d40065bc 100644 GSList *machines = object_class_get_list(TYPE_MACHINE, false); MachineClass *machine_class; Error *local_err = NULL; -@@ -1638,6 +1639,11 @@ static MachineClass *select_machine(QDict *qdict, Error **errp) +@@ -1672,6 +1673,11 @@ static MachineClass *select_machine(QDict *qdict, Error **errp) } } @@ -94,7 +94,7 @@ index d87cf6e103..e9d40065bc 100644 g_slist_free(machines); if (local_err) { error_append_hint(&local_err, "Use -machine help to list supported machines\n"); -@@ -3312,12 +3318,31 @@ void qemu_init(int argc, char **argv, char **envp) +@@ -3363,12 +3369,31 @@ void qemu_init(int argc, char **argv, char **envp) case QEMU_OPTION_machine: { bool help; diff --git a/debian/patches/pve/0025-PVE-Backup-add-vma-backup-format-code.patch b/debian/patches/pve/0025-PVE-Backup-add-vma-backup-format-code.patch index 46436f4..d28065e 100644 --- a/debian/patches/pve/0025-PVE-Backup-add-vma-backup-format-code.patch +++ b/debian/patches/pve/0025-PVE-Backup-add-vma-backup-format-code.patch @@ -18,7 +18,7 @@ Signed-off-by: Thomas Lamprecht create mode 100644 vma.h diff --git a/block/meson.build b/block/meson.build -index 7a0bc3df09..9ce9246194 100644 +index c9d1fdca7d..72081a9974 100644 --- a/block/meson.build +++ b/block/meson.build @@ -44,6 +44,8 @@ block_ss.add(files( @@ -31,21 +31,21 @@ index 7a0bc3df09..9ce9246194 100644 block_ss.add(when: 'CONFIG_QCOW1', if_true: files('qcow.c')) diff --git a/meson.build b/meson.build -index b3e7ec0e92..cc46eabb42 100644 +index 96de1a6ef9..54c23b9567 100644 --- a/meson.build +++ b/meson.build -@@ -1064,6 +1064,8 @@ keyutils = dependency('libkeyutils', required: false, +@@ -1202,6 +1202,8 @@ keyutils = dependency('libkeyutils', required: false, has_gettid = cc.has_function('gettid') +libuuid = cc.find_library('uuid', required: true) + - # Malloc tests - - malloc = [] -@@ -2743,6 +2745,9 @@ if have_tools - qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), - dependencies: [blockdev, qemuutil, gnutls], install: true) + # libselinux + selinux = dependency('libselinux', + required: get_option('selinux'), +@@ -3070,6 +3072,9 @@ if have_tools + dependencies: [blockdev, qemuutil, gnutls, selinux], + install: true) + vma = executable('vma', files('vma.c', 'vma-reader.c') + genh, + dependencies: [authz, block, crypto, io, qom], install: true) diff --git a/debian/patches/pve/0026-PVE-Backup-add-backup-dump-block-driver.patch b/debian/patches/pve/0026-PVE-Backup-add-backup-dump-block-driver.patch index 6da27d3..aa6e992 100644 --- a/debian/patches/pve/0026-PVE-Backup-add-backup-dump-block-driver.patch +++ b/debian/patches/pve/0026-PVE-Backup-add-backup-dump-block-driver.patch @@ -11,11 +11,11 @@ Subject: [PATCH] PVE-Backup: add backup-dump block driver Signed-off-by: Thomas Lamprecht --- block/backup-dump.c | 168 ++++++++++++++++++++++++++++++++++++++ - block/backup.c | 32 +++----- + block/backup.c | 30 ++----- block/meson.build | 1 + include/block/block_int.h | 35 ++++++++ job.c | 3 +- - 5 files changed, 216 insertions(+), 23 deletions(-) + 5 files changed, 214 insertions(+), 23 deletions(-) create mode 100644 block/backup-dump.c diff --git a/block/backup-dump.c b/block/backup-dump.c @@ -193,16 +193,16 @@ index 0000000000..93d7f46950 + return bs; +} diff --git a/block/backup.c b/block/backup.c -index bd3614ce70..8bae9b060e 100644 +index 21d5983779..7d9aed1a60 100644 --- a/block/backup.c +++ b/block/backup.c -@@ -31,28 +31,6 @@ +@@ -29,28 +29,6 @@ - #define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16) + #include "block/copy-before-write.h" -typedef struct BackupBlockJob { - BlockJob common; -- BlockDriverState *backup_top; +- BlockDriverState *cbw; - BlockDriverState *source_bs; - BlockDriverState *target_bs; - @@ -225,11 +225,10 @@ index bd3614ce70..8bae9b060e 100644 static const BlockJobDriver backup_job_driver; static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret) -@@ -504,6 +482,16 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, - goto error; +@@ -457,6 +435,14 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, } -+ cluster_size = backup_calculate_cluster_size(target, errp); + cluster_size = block_copy_cluster_size(bcs); + if (cluster_size < 0) { + goto error; + } @@ -238,12 +237,11 @@ index bd3614ce70..8bae9b060e 100644 + if (bdrv_get_info(bs, &bdi) == 0) { + cluster_size = MAX(cluster_size, bdi.cluster_size); + } -+ - /* - * If source is in backing chain of target assume that target is going to be - * used for "image fleecing", i.e. it should represent a kind of snapshot of + + if (perf->max_chunk && perf->max_chunk < cluster_size) { + error_setg(errp, "Required max-chunk (%" PRIi64 ") is less than backup " diff --git a/block/meson.build b/block/meson.build -index 9ce9246194..19bc2b7cbb 100644 +index 72081a9974..7883df047c 100644 --- a/block/meson.build +++ b/block/meson.build @@ -4,6 +4,7 @@ block_ss.add(files( @@ -251,11 +249,11 @@ index 9ce9246194..19bc2b7cbb 100644 'amend.c', 'backup.c', + 'backup-dump.c', - 'backup-top.c', + 'copy-before-write.c', 'blkdebug.c', 'blklogwrites.c', diff --git a/include/block/block_int.h b/include/block/block_int.h -index 11442893d0..8f6135e6a5 100644 +index ee0aeb1414..1574b5564b 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -26,6 +26,7 @@ @@ -266,7 +264,7 @@ index 11442893d0..8f6135e6a5 100644 #include "block/aio-wait.h" #include "qemu/queue.h" #include "qemu/coroutine.h" -@@ -63,6 +64,40 @@ +@@ -64,6 +65,40 @@ #define BLOCK_PROBE_BUF_SIZE 512 @@ -284,7 +282,7 @@ index 11442893d0..8f6135e6a5 100644 +typedef struct BlockCopyState BlockCopyState; +typedef struct BackupBlockJob { + BlockJob common; -+ BlockDriverState *backup_top; ++ BlockDriverState *cbw; + BlockDriverState *source_bs; + BlockDriverState *target_bs; + @@ -308,10 +306,10 @@ index 11442893d0..8f6135e6a5 100644 BDRV_TRACKED_READ, BDRV_TRACKED_WRITE, diff --git a/job.c b/job.c -index e7a5d28854..44eec9a441 100644 +index dbfa67bb0a..af25dd5b98 100644 --- a/job.c +++ b/job.c -@@ -269,7 +269,8 @@ static bool job_started(Job *job) +@@ -276,7 +276,8 @@ static bool job_started(Job *job) return job->co; } 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 30f6d2d..8d302b9 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 @@ -7,6 +7,8 @@ Signed-off-by: Dietmar Maurer [PVE-Backup: avoid coroutines to fix AIO freeze, cleanups] Signed-off-by: Stefan Reiter Signed-off-by: Thomas Lamprecht +[add new force parameter to job_cancel_sync calls] +Signed-off-by: Fabian Ebner --- block/meson.build | 5 + block/monitor/block-hmp-cmds.c | 33 ++ @@ -29,7 +31,7 @@ Signed-off-by: Thomas Lamprecht create mode 100644 pve-backup.c diff --git a/block/meson.build b/block/meson.build -index 19bc2b7cbb..9e433daf2e 100644 +index 7883df047c..9d3dd5b7c3 100644 --- a/block/meson.build +++ b/block/meson.build @@ -46,6 +46,11 @@ block_ss.add(files( @@ -45,7 +47,7 @@ index 19bc2b7cbb..9e433daf2e 100644 softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c')) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c -index 3e6670c963..1e29681d30 100644 +index 2ac4aedfff..f6668ab01d 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -1015,3 +1015,36 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict) @@ -86,7 +88,7 @@ index 3e6670c963..1e29681d30 100644 + hmp_handle_error(mon, error); +} diff --git a/blockdev.c b/blockdev.c -index b6f797b41f..84e9b898be 100644 +index 4be0863050..29fee73cbd 100644 --- a/blockdev.c +++ b/blockdev.c @@ -36,6 +36,7 @@ @@ -98,10 +100,10 @@ index b6f797b41f..84e9b898be 100644 #include "monitor/monitor.h" #include "qemu/error-report.h" diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx -index e6dd3be07a..15ddecada1 100644 +index 245f8acc55..3e7f2421eb 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx -@@ -497,6 +497,20 @@ SRST +@@ -482,6 +482,20 @@ SRST Show the current VM UUID. ERST @@ -123,7 +125,7 @@ index e6dd3be07a..15ddecada1 100644 { .name = "usernet", diff --git a/hmp-commands.hx b/hmp-commands.hx -index 42203dbe92..7faba36b39 100644 +index 1ad13b668b..d4bb00216e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -99,6 +99,35 @@ ERST @@ -163,10 +165,10 @@ index 42203dbe92..7faba36b39 100644 { diff --git a/include/block/block_int.h b/include/block/block_int.h -index 8f6135e6a5..4a572a2e34 100644 +index 1574b5564b..77076d7be3 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h -@@ -66,7 +66,7 @@ +@@ -67,7 +67,7 @@ typedef int BackupDumpFunc(void *opaque, uint64_t offset, uint64_t bytes, const void *buf); @@ -176,10 +178,10 @@ index 8f6135e6a5..4a572a2e34 100644 uint64_t byte_size, BackupDumpFunc *dump_cb, diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h -index 1247d7362a..8d3df46c93 100644 +index 3a39ba41b5..d269b4c99c 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h -@@ -29,6 +29,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict); +@@ -30,6 +30,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict); void hmp_info_migrate(Monitor *mon, const QDict *qdict); void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict); @@ -187,7 +189,7 @@ index 1247d7362a..8d3df46c93 100644 void hmp_info_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vnc(Monitor *mon, const QDict *qdict); void hmp_info_spice(Monitor *mon, const QDict *qdict); -@@ -72,6 +73,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict); +@@ -73,6 +74,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict); void hmp_set_password(Monitor *mon, const QDict *qdict); void hmp_expire_password(Monitor *mon, const QDict *qdict); void hmp_change(Monitor *mon, const QDict *qdict); @@ -197,19 +199,19 @@ index 1247d7362a..8d3df46c93 100644 void hmp_device_add(Monitor *mon, const QDict *qdict); void hmp_device_del(Monitor *mon, const QDict *qdict); diff --git a/meson.build b/meson.build -index cc46eabb42..7d7e474313 100644 +index 54c23b9567..37dab249cc 100644 --- a/meson.build +++ b/meson.build -@@ -1065,6 +1065,7 @@ keyutils = dependency('libkeyutils', required: false, +@@ -1203,6 +1203,7 @@ keyutils = dependency('libkeyutils', required: false, has_gettid = cc.has_function('gettid') libuuid = cc.find_library('uuid', required: true) +libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true) - # Malloc tests - + # libselinux + selinux = dependency('libselinux', diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c -index 64a84cf4ee..7efcd2d641 100644 +index 5000ce39d1..b2687eae3a 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -195,6 +195,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict) @@ -512,7 +514,7 @@ index 0000000000..1dda8b7d8f +#endif /* PROXMOX_BACKUP_CLIENT_H */ diff --git a/pve-backup.c b/pve-backup.c new file mode 100644 -index 0000000000..66868dec14 +index 0000000000..88f5ee133f --- /dev/null +++ b/pve-backup.c @@ -0,0 +1,959 @@ @@ -872,7 +874,7 @@ index 0000000000..66868dec14 + if (next_job) { + AioContext *aio_context = next_job->job.aio_context; + aio_context_acquire(aio_context); -+ job_cancel_sync(&next_job->job); ++ job_cancel_sync(&next_job->job, true); + aio_context_release(aio_context); + } else { + break; @@ -959,7 +961,7 @@ index 0000000000..66868dec14 + if (job_should_pause(&job->job)) { + bool error_or_canceled = pvebackup_error_or_canceled(); + if (error_or_canceled) { -+ job_cancel_sync(&job->job); ++ job_cancel_sync(&job->job, true); + } else { + job_resume(&job->job); + } @@ -1476,10 +1478,10 @@ index 0000000000..66868dec14 + return info; +} diff --git a/qapi/block-core.json b/qapi/block-core.json -index fdfa579d00..c5d604693f 100644 +index cd69af921e..e4c3de0804 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -699,6 +699,115 @@ +@@ -744,6 +744,115 @@ { 'command': 'query-block', 'returns': ['BlockInfo'] } @@ -1596,13 +1598,13 @@ index fdfa579d00..c5d604693f 100644 # @BlockDeviceTimedStats: # diff --git a/qapi/common.json b/qapi/common.json -index 7c976296f0..0690b07903 100644 +index 412cc4f5ae..3e7a77ea66 100644 --- a/qapi/common.json +++ b/qapi/common.json -@@ -197,3 +197,16 @@ - { 'enum': 'GrabToggleKeys', - 'data': [ 'ctrl-ctrl', 'alt-alt', 'shift-shift','meta-meta', 'scrolllock', - 'ctrl-scrolllock' ] } +@@ -208,3 +208,16 @@ + ## + { 'struct': 'HumanReadableText', + 'data': { 'human-readable-text': 'str' } } + +## +# @UuidInfo: @@ -1617,7 +1619,7 @@ index 7c976296f0..0690b07903 100644 +## +{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} } diff --git a/qapi/machine.json b/qapi/machine.json -index a6f483af4f..6effa7ad30 100644 +index a05c46e253..e2cec7922f 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -4,6 +4,8 @@ diff --git a/debian/patches/pve/0028-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch b/debian/patches/pve/0028-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch index 2002f4a..132d390 100644 --- a/debian/patches/pve/0028-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch +++ b/debian/patches/pve/0028-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch @@ -12,10 +12,10 @@ Signed-off-by: Thomas Lamprecht create mode 100644 pbs-restore.c diff --git a/meson.build b/meson.build -index 7d7e474313..dd1c5bdb4e 100644 +index 37dab249cc..1a4dfab4e2 100644 --- a/meson.build +++ b/meson.build -@@ -2749,6 +2749,10 @@ if have_tools +@@ -3076,6 +3076,10 @@ if have_tools vma = executable('vma', files('vma.c', 'vma-reader.c') + genh, dependencies: [authz, block, crypto, io, qom], install: true) diff --git a/debian/patches/pve/0029-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch b/debian/patches/pve/0029-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch index 6755d9d..ff991d2 100644 --- a/debian/patches/pve/0029-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch +++ b/debian/patches/pve/0029-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch @@ -29,7 +29,7 @@ Signed-off-by: Thomas Lamprecht 6 files changed, 142 insertions(+), 23 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c -index 1e29681d30..3fca3ce3e9 100644 +index f6668ab01d..3c06734e6d 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -1042,6 +1042,7 @@ void hmp_backup(Monitor *mon, const QDict *qdict) @@ -41,7 +41,7 @@ index 1e29681d30..3fca3ce3e9 100644 false, NULL, false, NULL, !!devlist, devlist, qdict_haskey(qdict, "speed"), speed, &error); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c -index 7efcd2d641..b2b5f1298b 100644 +index b2687eae3a..cfd7a60f32 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -221,19 +221,42 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict) @@ -132,7 +132,7 @@ index 1dda8b7d8f..8cbf645b2c 100644 diff --git a/pve-backup.c b/pve-backup.c -index 66868dec14..6cdbd40529 100644 +index 88f5ee133f..1c49cd178d 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -28,6 +28,8 @@ @@ -405,10 +405,10 @@ index 66868dec14..6cdbd40529 100644 qemu_mutex_unlock(&backup_state.stat.lock); diff --git a/qapi/block-core.json b/qapi/block-core.json -index c5d604693f..a138ad08d4 100644 +index e4c3de0804..379a8dd147 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -712,8 +712,13 @@ +@@ -757,8 +757,13 @@ # # @total: total amount of bytes involved in the backup process # @@ -422,7 +422,7 @@ index c5d604693f..a138ad08d4 100644 # @zero-bytes: amount of 'zero' bytes detected. # # @start-time: time (epoch) when backup job started. -@@ -726,8 +731,8 @@ +@@ -771,8 +776,8 @@ # ## { 'struct': 'BackupStatus', @@ -433,7 +433,7 @@ index c5d604693f..a138ad08d4 100644 '*start-time': 'int', '*end-time': 'int', '*backup-file': 'str', '*uuid': 'str' } } -@@ -770,6 +775,8 @@ +@@ -815,6 +820,8 @@ # # @backup-time: backup timestamp (Unix epoch, required for format 'pbs') # @@ -442,7 +442,7 @@ index c5d604693f..a138ad08d4 100644 # Returns: the uuid of the backup job # ## -@@ -780,6 +787,7 @@ +@@ -825,6 +832,7 @@ '*fingerprint': 'str', '*backup-id': 'str', '*backup-time': 'int', diff --git a/debian/patches/pve/0030-PVE-various-PBS-fixes.patch b/debian/patches/pve/0030-PVE-various-PBS-fixes.patch index 9ac0d4c..39a3eb2 100644 --- a/debian/patches/pve/0030-PVE-various-PBS-fixes.patch +++ b/debian/patches/pve/0030-PVE-various-PBS-fixes.patch @@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c -index 3fca3ce3e9..69254396d5 100644 +index 3c06734e6d..4481b60a5c 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -1042,7 +1042,9 @@ void hmp_backup(Monitor *mon, const QDict *qdict) @@ -34,7 +34,7 @@ index 3fca3ce3e9..69254396d5 100644 false, NULL, false, NULL, !!devlist, devlist, qdict_haskey(qdict, "speed"), speed, &error); diff --git a/pve-backup.c b/pve-backup.c -index 6cdbd40529..7527885251 100644 +index 1c49cd178d..c15abefdda 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -8,6 +8,7 @@ @@ -194,10 +194,10 @@ index 6cdbd40529..7527885251 100644 .format = format, .has_config_file = has_config_file, diff --git a/qapi/block-core.json b/qapi/block-core.json -index a138ad08d4..a75f1b4687 100644 +index 379a8dd147..88835ebcf6 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -777,6 +777,10 @@ +@@ -822,6 +822,10 @@ # # @use-dirty-bitmap: use dirty bitmap to detect incremental changes since last job (optional for format 'pbs') # @@ -208,7 +208,7 @@ index a138ad08d4..a75f1b4687 100644 # Returns: the uuid of the backup job # ## -@@ -788,6 +792,8 @@ +@@ -833,6 +837,8 @@ '*backup-id': 'str', '*backup-time': 'int', '*use-dirty-bitmap': 'bool', diff --git a/debian/patches/pve/0031-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch b/debian/patches/pve/0031-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch index 3b471ed..10edf43 100644 --- a/debian/patches/pve/0031-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch +++ b/debian/patches/pve/0031-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch @@ -7,17 +7,19 @@ Signed-off-by: Stefan Reiter [error cleanups, file_open implementation] Signed-off-by: Dietmar Maurer Signed-off-by: Thomas Lamprecht +[adapt to changed function signatures] +Signed-off-by: Fabian Ebner --- block/meson.build | 3 + - block/pbs.c | 271 +++++++++++++++++++++++++++++++++++++++++++ + block/pbs.c | 276 +++++++++++++++++++++++++++++++++++++++++++ configure | 9 ++ meson.build | 1 + - qapi/block-core.json | 13 +++ - 5 files changed, 297 insertions(+) + qapi/block-core.json | 13 ++ + 5 files changed, 302 insertions(+) create mode 100644 block/pbs.c diff --git a/block/meson.build b/block/meson.build -index 9e433daf2e..e3ed5ac97c 100644 +index 9d3dd5b7c3..8c758c0218 100644 --- a/block/meson.build +++ b/block/meson.build @@ -51,6 +51,9 @@ block_ss.add(files( @@ -32,10 +34,10 @@ index 9e433daf2e..e3ed5ac97c 100644 diff --git a/block/pbs.c b/block/pbs.c new file mode 100644 -index 0000000000..78dad0dcc4 +index 0000000000..0b05ea9080 --- /dev/null +++ b/block/pbs.c -@@ -0,0 +1,271 @@ +@@ -0,0 +1,276 @@ +/* + * Proxmox Backup Server read-only block driver + */ @@ -232,20 +234,25 @@ index 0000000000..78dad0dcc4 +} + +static coroutine_fn int pbs_co_preadv(BlockDriverState *bs, -+ uint64_t offset, uint64_t bytes, -+ QEMUIOVector *qiov, int flags) ++ int64_t offset, int64_t bytes, ++ QEMUIOVector *qiov, BdrvRequestFlags flags) +{ + BDRVPBSState *s = bs->opaque; + int ret; + char *pbs_error = NULL; + uint8_t *buf = malloc(bytes); + ++ if (offset < 0 || bytes < 0) { ++ fprintf(stderr, "unexpected negative 'offset' or 'bytes' value!\n"); ++ return -EINVAL; ++ } ++ + ReadCallbackData rcb = { + .co = qemu_coroutine_self(), + .ctx = bdrv_get_aio_context(bs), + }; + -+ proxmox_restore_read_image_at_async(s->conn, s->aid, buf, offset, bytes, ++ proxmox_restore_read_image_at_async(s->conn, s->aid, buf, (uint64_t)offset, (uint64_t)bytes, + read_callback, (void *) &rcb, &ret, &pbs_error); + + qemu_coroutine_yield(); @@ -263,8 +270,8 @@ index 0000000000..78dad0dcc4 +} + +static coroutine_fn int pbs_co_pwritev(BlockDriverState *bs, -+ uint64_t offset, uint64_t bytes, -+ QEMUIOVector *qiov, int flags) ++ int64_t offset, int64_t bytes, ++ QEMUIOVector *qiov, BdrvRequestFlags flags) +{ + fprintf(stderr, "pbs-bdrv: cannot write to backup file, make sure " + "any attached disk devices are set to read-only!\n"); @@ -308,18 +315,18 @@ index 0000000000..78dad0dcc4 + +block_init(bdrv_pbs_init); diff --git a/configure b/configure -index 6e308ed77f..869e97c72f 100755 +index 48c21775f3..eda4e9225a 100755 --- a/configure +++ b/configure -@@ -428,6 +428,7 @@ vdi=${default_feature:-yes} +@@ -356,6 +356,7 @@ vdi=${default_feature:-yes} vvfat=${default_feature:-yes} qed=${default_feature:-yes} parallels=${default_feature:-yes} +pbs_bdrv="yes" - libxml2="auto" debug_mutex="no" - libpmem="auto" -@@ -1486,6 +1487,10 @@ for opt do + plugins="$default_feature" + rng_none="no" +@@ -1126,6 +1127,10 @@ for opt do ;; --enable-parallels) parallels="yes" ;; @@ -330,17 +337,17 @@ index 6e308ed77f..869e97c72f 100755 --disable-vhost-user) vhost_user="no" ;; --enable-vhost-user) vhost_user="yes" -@@ -1956,6 +1961,7 @@ disabled with --disable-FEATURE, default is enabled if available +@@ -1465,6 +1470,7 @@ cat << EOF vvfat vvfat image format support qed qed image format support parallels parallels image format support + pbs-bdrv Proxmox backup server read-only block driver support crypto-afalg Linux AF_ALG crypto backend driver - capstone capstone disassembler support debug-mutex mutex debugging support -@@ -4624,6 +4630,9 @@ fi - if test "$linux_aio" = "yes" ; then - echo "CONFIG_LINUX_AIO=y" >> $config_host_mak + rng-none dummy RNG, avoid using /dev/(u)random and getrandom() +@@ -3534,6 +3540,9 @@ if test "$xen" = "enabled" ; then + echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak + echo "XEN_LIBS=$xen_libs" >> $config_host_mak fi +if test "$pbs_bdrv" = "yes" ; then + echo "CONFIG_PBS_BDRV=y" >> $config_host_mak @@ -349,30 +356,30 @@ index 6e308ed77f..869e97c72f 100755 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build -index dd1c5bdb4e..45c1f2de73 100644 +index 1a4dfab4e2..85b3c63199 100644 --- a/meson.build +++ b/meson.build -@@ -3111,6 +3111,7 @@ summary_info += {'lzfse support': liblzfse.found()} - summary_info += {'zstd support': zstd.found()} +@@ -3448,6 +3448,7 @@ summary_info += {'lzfse support': liblzfse} + summary_info += {'zstd support': zstd} summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')} - summary_info += {'libxml2': libxml2.found()} + summary_info += {'libxml2': libxml2} +summary_info += {'PBS bdrv support': config_host.has_key('CONFIG_PBS_BDRV')} - summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt} - summary_info += {'libpmem support': libpmem.found()} - summary_info += {'libdaxctl support': libdaxctl.found()} + summary_info += {'capstone': capstone_opt == 'internal' ? capstone_opt : capstone} + summary_info += {'libpmem support': libpmem} + summary_info += {'libdaxctl support': libdaxctl} diff --git a/qapi/block-core.json b/qapi/block-core.json -index a75f1b4687..e4d0c923a4 100644 +index 88835ebcf6..fd1ba7ccac 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -2982,6 +2982,7 @@ +@@ -3074,6 +3074,7 @@ 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', - { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, + { 'name': 'replication', 'if': 'CONFIG_REPLICATION' }, + 'pbs', 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } ## -@@ -3045,6 +3046,17 @@ +@@ -3146,6 +3147,17 @@ { 'struct': 'BlockdevOptionsNull', 'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } } @@ -390,7 +397,7 @@ index a75f1b4687..e4d0c923a4 100644 ## # @BlockdevOptionsNVMe: # -@@ -4263,6 +4275,7 @@ +@@ -4388,6 +4400,7 @@ 'nfs': 'BlockdevOptionsNfs', 'null-aio': 'BlockdevOptionsNull', 'null-co': 'BlockdevOptionsNull', diff --git a/debian/patches/pve/0032-PVE-add-query_proxmox_support-QMP-command.patch b/debian/patches/pve/0032-PVE-add-query_proxmox_support-QMP-command.patch index 6cc197e..0b92aab 100644 --- a/debian/patches/pve/0032-PVE-add-query_proxmox_support-QMP-command.patch +++ b/debian/patches/pve/0032-PVE-add-query_proxmox_support-QMP-command.patch @@ -16,7 +16,7 @@ Signed-off-by: Stefan Reiter 2 files changed, 38 insertions(+) diff --git a/pve-backup.c b/pve-backup.c -index 7527885251..8cba8e97d3 100644 +index c15abefdda..4684789813 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -1075,3 +1075,12 @@ BackupStatus *qmp_query_backup(Error **errp) @@ -33,10 +33,10 @@ index 7527885251..8cba8e97d3 100644 + return ret; +} diff --git a/qapi/block-core.json b/qapi/block-core.json -index e4d0c923a4..3eebe7ff71 100644 +index fd1ba7ccac..fc498b779d 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -822,6 +822,35 @@ +@@ -867,6 +867,35 @@ ## { 'command': 'backup-cancel' } diff --git a/debian/patches/pve/0033-PVE-add-query-pbs-bitmap-info-QMP-call.patch b/debian/patches/pve/0033-PVE-add-query-pbs-bitmap-info-QMP-call.patch index 133f4f9..a8e3458 100644 --- a/debian/patches/pve/0033-PVE-add-query-pbs-bitmap-info-QMP-call.patch +++ b/debian/patches/pve/0033-PVE-add-query-pbs-bitmap-info-QMP-call.patch @@ -15,7 +15,7 @@ Signed-off-by: Thomas Lamprecht 3 files changed, 159 insertions(+), 42 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c -index b2b5f1298b..7a449edafa 100644 +index cfd7a60f32..b613190a3c 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -198,6 +198,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict) @@ -69,7 +69,7 @@ index b2b5f1298b..7a449edafa 100644 info->zero_bytes, zero_per); diff --git a/pve-backup.c b/pve-backup.c -index 8cba8e97d3..22420db26a 100644 +index 4684789813..f90abaa50a 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -46,6 +46,7 @@ static struct PVEBackupState { @@ -359,10 +359,10 @@ index 8cba8e97d3..22420db26a 100644 return ret; } diff --git a/qapi/block-core.json b/qapi/block-core.json -index 3eebe7ff71..170c13984d 100644 +index fc498b779d..7b171fe27c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -830,6 +830,8 @@ +@@ -875,6 +875,8 @@ # @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are # supported. # @@ -371,7 +371,7 @@ index 3eebe7ff71..170c13984d 100644 # @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can # safely be set for savevm-async. # -@@ -838,6 +840,7 @@ +@@ -883,6 +885,7 @@ ## { 'struct': 'ProxmoxSupportStatus', 'data': { 'pbs-dirty-bitmap': 'bool', @@ -379,7 +379,7 @@ index 3eebe7ff71..170c13984d 100644 'pbs-dirty-bitmap-savevm': 'bool', 'pbs-library-version': 'str' } } -@@ -851,6 +854,59 @@ +@@ -896,6 +899,59 @@ ## { 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' } diff --git a/debian/patches/pve/0034-PVE-redirect-stderr-to-journal-when-daemonized.patch b/debian/patches/pve/0034-PVE-redirect-stderr-to-journal-when-daemonized.patch index d85cc27..9085387 100644 --- a/debian/patches/pve/0034-PVE-redirect-stderr-to-journal-when-daemonized.patch +++ b/debian/patches/pve/0034-PVE-redirect-stderr-to-journal-when-daemonized.patch @@ -14,18 +14,18 @@ Signed-off-by: Thomas Lamprecht 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build -index 45c1f2de73..44071acbb7 100644 +index 85b3c63199..31ba7d70d6 100644 --- a/meson.build +++ b/meson.build -@@ -1065,6 +1065,7 @@ keyutils = dependency('libkeyutils', required: false, +@@ -1203,6 +1203,7 @@ keyutils = dependency('libkeyutils', required: false, has_gettid = cc.has_function('gettid') libuuid = cc.find_library('uuid', required: true) +libsystemd = cc.find_library('systemd', required: true) libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true) - # Malloc tests -@@ -2246,6 +2247,7 @@ if have_block + # libselinux +@@ -2571,6 +2572,7 @@ if have_block # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon, # os-win32.c does not blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) diff --git a/debian/patches/pve/0035-PVE-Add-sequential-job-transaction-support.patch b/debian/patches/pve/0035-PVE-Add-sequential-job-transaction-support.patch index 4e446cc..3a56d3c 100644 --- a/debian/patches/pve/0035-PVE-Add-sequential-job-transaction-support.patch +++ b/debian/patches/pve/0035-PVE-Add-sequential-job-transaction-support.patch @@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht 2 files changed, 43 insertions(+) diff --git a/include/qemu/job.h b/include/qemu/job.h -index 41162ed494..6662c63519 100644 +index 6e67b6977f..60376c99ee 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h -@@ -285,6 +285,18 @@ typedef enum JobCreateFlags { +@@ -294,6 +294,18 @@ typedef enum JobCreateFlags { */ JobTxn *job_txn_new(void); @@ -34,7 +34,7 @@ index 41162ed494..6662c63519 100644 * Release a reference that was previously acquired with job_txn_add_job or * job_txn_new. If it's the last reference to the object, it will be freed. diff --git a/job.c b/job.c -index 44eec9a441..a0753ff2f1 100644 +index af25dd5b98..d0d152e697 100644 --- a/job.c +++ b/job.c @@ -72,6 +72,8 @@ struct JobTxn { @@ -72,7 +72,7 @@ index 44eec9a441..a0753ff2f1 100644 static void job_txn_ref(JobTxn *txn) { txn->refcnt++; -@@ -850,6 +871,9 @@ static void job_completed_txn_success(Job *job) +@@ -888,6 +909,9 @@ static void job_completed_txn_success(Job *job) */ QLIST_FOREACH(other_job, &txn->jobs, txn_list) { if (!job_is_completed(other_job)) { @@ -82,7 +82,7 @@ index 44eec9a441..a0753ff2f1 100644 return; } assert(other_job->ret == 0); -@@ -1020,6 +1044,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp) +@@ -1082,6 +1106,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp) return -EBUSY; } diff --git a/debian/patches/pve/0036-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch b/debian/patches/pve/0036-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch index c17a52f..c7c31de 100644 --- a/debian/patches/pve/0036-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch +++ b/debian/patches/pve/0036-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch @@ -12,12 +12,14 @@ transaction, so drives will still be backed up one after the other. Signed-off-by: Stefan Reiter Signed-off-by: Thomas Lamprecht +[add new force parameter to job_cancel_sync calls] +Signed-off-by: Fabian Ebner --- pve-backup.c | 169 +++++++++++++++------------------------------------ 1 file changed, 50 insertions(+), 119 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 22420db26a..2e628d68e4 100644 +index f90abaa50a..63c686463f 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -52,6 +52,7 @@ static struct PVEBackupState { @@ -160,7 +162,7 @@ index 22420db26a..2e628d68e4 100644 - if (next_job) { - AioContext *aio_context = next_job->job.aio_context; - aio_context_acquire(aio_context); -- job_cancel_sync(&next_job->job); +- job_cancel_sync(&next_job->job, true); - aio_context_release(aio_context); - } else { - break; @@ -168,7 +170,7 @@ index 22420db26a..2e628d68e4 100644 + if (cancel_job) { + AioContext *aio_context = cancel_job->job.aio_context; + aio_context_acquire(aio_context); -+ job_cancel_sync(&cancel_job->job); ++ job_cancel_sync(&cancel_job->job, true); + job_unref(&cancel_job->job); + aio_context_release(aio_context); } @@ -202,7 +204,7 @@ index 22420db26a..2e628d68e4 100644 - if (job_should_pause(&job->job)) { - bool error_or_canceled = pvebackup_error_or_canceled(); - if (error_or_canceled) { -- job_cancel_sync(&job->job); +- job_cancel_sync(&job->job, true); - } else { - job_resume(&job->job); - } diff --git a/debian/patches/pve/0037-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch b/debian/patches/pve/0037-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch index 4ab8ac8..e6722ba 100644 --- a/debian/patches/pve/0037-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch +++ b/debian/patches/pve/0037-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch @@ -49,13 +49,15 @@ before. Signed-off-by: Stefan Reiter Signed-off-by: Thomas Lamprecht +[add new force parameter to job_cancel_sync calls] +Signed-off-by: Fabian Ebner --- pve-backup.c | 217 ++++++++++++++++++++++++++++--------------- qapi/block-core.json | 5 +- 2 files changed, 144 insertions(+), 78 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 2e628d68e4..9c20ef3a5e 100644 +index 63c686463f..6f05796fad 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap"; @@ -229,7 +231,7 @@ index 2e628d68e4..9c20ef3a5e 100644 + Job *job = (Job*)data->data; + AioContext *job_ctx = job->aio_context; + aio_context_acquire(job_ctx); -+ job_cancel_sync(job); ++ job_cancel_sync(job, true); + aio_context_release(job_ctx); + aio_co_enter(data->ctx, data->co); +} @@ -268,7 +270,7 @@ index 2e628d68e4..9c20ef3a5e 100644 - if (cancel_job) { - AioContext *aio_context = cancel_job->job.aio_context; - aio_context_acquire(aio_context); -- job_cancel_sync(&cancel_job->job); +- job_cancel_sync(&cancel_job->job, true); - job_unref(&cancel_job->job); - aio_context_release(aio_context); - } @@ -338,7 +340,7 @@ index 2e628d68e4..9c20ef3a5e 100644 if (di->job) { + AioContext *ctx = di->job->job.aio_context; + aio_context_acquire(ctx); -+ job_cancel_sync(&di->job->job); ++ job_cancel_sync(&di->job->job, true); job_unref(&di->job->job); + aio_context_release(ctx); } @@ -479,10 +481,10 @@ index 2e628d68e4..9c20ef3a5e 100644 qemu_mutex_unlock(&backup_state.stat.lock); diff --git a/qapi/block-core.json b/qapi/block-core.json -index 170c13984d..a0d1d278e9 100644 +index 7b171fe27c..66a0e9fd6c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -729,12 +729,15 @@ +@@ -774,12 +774,15 @@ # # @uuid: uuid for this backup job # diff --git a/debian/patches/pve/0038-PVE-Migrate-dirty-bitmap-state-via-savevm.patch b/debian/patches/pve/0038-PVE-Migrate-dirty-bitmap-state-via-savevm.patch index b155c3d..812343b 100644 --- a/debian/patches/pve/0038-PVE-Migrate-dirty-bitmap-state-via-savevm.patch +++ b/debian/patches/pve/0038-PVE-Migrate-dirty-bitmap-state-via-savevm.patch @@ -51,17 +51,17 @@ index ea9aedeefc..c27dc9bd97 100644 softmmu_ss.add(files( 'block-dirty-bitmap.c', diff --git a/migration/migration.c b/migration/migration.c -index 041b8451a6..9df2eed75e 100644 +index abaf6f9e3d..d925fd7488 100644 --- a/migration/migration.c +++ b/migration/migration.c -@@ -218,6 +218,7 @@ void migration_object_init(void) +@@ -213,6 +213,7 @@ void migration_object_init(void) blk_mig_init(); ram_mig_init(); dirty_bitmap_mig_init(); + pbs_state_mig_init(); } - void migration_cancel(void) + void migration_cancel(const Error *error) diff --git a/migration/pbs-state.c b/migration/pbs-state.c new file mode 100644 index 0000000000..29f2b3860d @@ -175,7 +175,7 @@ index 0000000000..29f2b3860d + NULL); +} diff --git a/pve-backup.c b/pve-backup.c -index 9c20ef3a5e..59ccb38ceb 100644 +index 6f05796fad..5fa3cc1352 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -1132,6 +1132,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) @@ -187,10 +187,10 @@ index 9c20ef3a5e..59ccb38ceb 100644 return ret; } diff --git a/qapi/block-core.json b/qapi/block-core.json -index a0d1d278e9..e5de769dc1 100644 +index 66a0e9fd6c..f6a5fb263a 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -838,6 +838,11 @@ +@@ -883,6 +883,11 @@ # @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can # safely be set for savevm-async. # @@ -202,7 +202,7 @@ index a0d1d278e9..e5de769dc1 100644 # @pbs-library-version: Running version of libproxmox-backup-qemu0 library. # ## -@@ -845,6 +850,7 @@ +@@ -890,6 +895,7 @@ 'data': { 'pbs-dirty-bitmap': 'bool', 'query-bitmap-info': 'bool', 'pbs-dirty-bitmap-savevm': 'bool', diff --git a/debian/patches/pve/0039-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch b/debian/patches/pve/0039-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch index 2ea32e2..074daf7 100644 --- a/debian/patches/pve/0039-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch +++ b/debian/patches/pve/0039-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch @@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c -index 35f5ef688d..c4640925e7 100644 +index 9aba7d9c22..f4ecf9c9f9 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -538,7 +538,7 @@ static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs, diff --git a/debian/patches/pve/0040-PVE-fall-back-to-open-iscsi-initiatorname.patch b/debian/patches/pve/0040-PVE-fall-back-to-open-iscsi-initiatorname.patch index d324d7b..ae11626 100644 --- a/debian/patches/pve/0040-PVE-fall-back-to-open-iscsi-initiatorname.patch +++ b/debian/patches/pve/0040-PVE-fall-back-to-open-iscsi-initiatorname.patch @@ -21,10 +21,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 30 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c -index 4d2a416ce7..c345d30812 100644 +index 57aa07a40d..a8902b84d5 100644 --- a/block/iscsi.c +++ b/block/iscsi.c -@@ -1372,12 +1372,42 @@ static char *get_initiator_name(QemuOpts *opts) +@@ -1386,12 +1386,42 @@ static char *get_initiator_name(QemuOpts *opts) const char *name; char *iscsi_name; UuidInfo *uuid_info; diff --git a/debian/patches/pve/0041-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch b/debian/patches/pve/0041-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch index bbe964e..2b97bfb 100644 --- a/debian/patches/pve/0041-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch +++ b/debian/patches/pve/0041-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch @@ -32,7 +32,7 @@ Signed-off-by: Thomas Lamprecht 5 files changed, 77 insertions(+), 196 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c -index 69254396d5..b838586fc0 100644 +index 4481b60a5c..c9849a5b29 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -1016,7 +1016,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict) @@ -54,7 +54,7 @@ index 69254396d5..b838586fc0 100644 Error *error = NULL; diff --git a/hmp-commands.hx b/hmp-commands.hx -index 7faba36b39..dca4e58858 100644 +index d4bb00216e..4e21911fa6 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -109,6 +109,7 @@ ERST @@ -116,7 +116,7 @@ index 4ce7bc0b5e..0923037dec 100644 static void proxmox_backup_schedule_wake(void *data) { CoCtxData *waker = (CoCtxData *)data; diff --git a/pve-backup.c b/pve-backup.c -index 59ccb38ceb..f858003a06 100644 +index 5fa3cc1352..323014744c 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -357,7 +357,7 @@ static void job_cancel_bh(void *opaque) { @@ -575,10 +575,10 @@ index 59ccb38ceb..f858003a06 100644 BackupStatus *qmp_query_backup(Error **errp) diff --git a/qapi/block-core.json b/qapi/block-core.json -index e5de769dc1..afa67c28d2 100644 +index f6a5fb263a..f216035d3c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -801,7 +801,7 @@ +@@ -846,7 +846,7 @@ '*config-file': 'str', '*firewall-file': 'str', '*devlist': 'str', '*speed': 'int' }, @@ -587,7 +587,7 @@ index e5de769dc1..afa67c28d2 100644 ## # @query-backup: -@@ -823,7 +823,7 @@ +@@ -868,7 +868,7 @@ # Notes: This command succeeds even if there is no backup process running. # ## diff --git a/debian/patches/pve/0042-PBS-add-master-key-support.patch b/debian/patches/pve/0042-PBS-add-master-key-support.patch index 7c30dd6..f14d4d9 100644 --- a/debian/patches/pve/0042-PBS-add-master-key-support.patch +++ b/debian/patches/pve/0042-PBS-add-master-key-support.patch @@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht 3 files changed, 11 insertions(+) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c -index b838586fc0..5b52b93232 100644 +index c9849a5b29..52ddbf95ad 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -1039,6 +1039,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict) @@ -31,7 +31,7 @@ index b838586fc0..5b52b93232 100644 false, NULL, // PBS backup-id false, 0, // PBS backup-time diff --git a/pve-backup.c b/pve-backup.c -index f858003a06..04ebfc1e33 100644 +index 323014744c..9f6c04a512 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -533,6 +533,7 @@ UuidInfo coroutine_fn *qmp_backup( @@ -58,10 +58,10 @@ index f858003a06..04ebfc1e33 100644 return ret; } diff --git a/qapi/block-core.json b/qapi/block-core.json -index afa67c28d2..84e4406d21 100644 +index f216035d3c..c5023710f5 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -772,6 +772,8 @@ +@@ -817,6 +817,8 @@ # # @key-password: password for keyfile (optional for format 'pbs') # @@ -70,7 +70,7 @@ index afa67c28d2..84e4406d21 100644 # @fingerprint: server cert fingerprint (optional for format 'pbs') # # @backup-id: backup ID (required for format 'pbs') -@@ -791,6 +793,7 @@ +@@ -836,6 +838,7 @@ '*password': 'str', '*keyfile': 'str', '*key-password': 'str', @@ -78,7 +78,7 @@ index afa67c28d2..84e4406d21 100644 '*fingerprint': 'str', '*backup-id': 'str', '*backup-time': 'int', -@@ -843,6 +846,9 @@ +@@ -888,6 +891,9 @@ # migration cap if this is false/unset may lead # to crashes on migration! # @@ -88,7 +88,7 @@ index afa67c28d2..84e4406d21 100644 # @pbs-library-version: Running version of libproxmox-backup-qemu0 library. # ## -@@ -851,6 +857,7 @@ +@@ -896,6 +902,7 @@ 'query-bitmap-info': 'bool', 'pbs-dirty-bitmap-savevm': 'bool', 'pbs-dirty-bitmap-migration': 'bool', diff --git a/debian/patches/pve/0043-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch b/debian/patches/pve/0043-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch index b2fca41..893104a 100644 --- a/debian/patches/pve/0043-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch +++ b/debian/patches/pve/0043-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch @@ -17,7 +17,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/block/pbs.c b/block/pbs.c -index 78dad0dcc4..ac54e816c0 100644 +index 0b05ea9080..c5eb4d5bad 100644 --- a/block/pbs.c +++ b/block/pbs.c @@ -200,7 +200,16 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs, @@ -36,9 +36,9 @@ index 78dad0dcc4..ac54e816c0 100644 + buf = g_malloc(bytes); + } - ReadCallbackData rcb = { - .co = qemu_coroutine_self(), -@@ -218,8 +227,10 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs, + if (offset < 0 || bytes < 0) { + fprintf(stderr, "unexpected negative 'offset' or 'bytes' value!\n"); +@@ -223,8 +232,10 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs, return -EIO; } diff --git a/debian/patches/pve/0044-PVE-block-stream-increase-chunk-size.patch b/debian/patches/pve/0044-PVE-block-stream-increase-chunk-size.patch index 9bd47f7..fe0ec25 100644 --- a/debian/patches/pve/0044-PVE-block-stream-increase-chunk-size.patch +++ b/debian/patches/pve/0044-PVE-block-stream-increase-chunk-size.patch @@ -11,7 +11,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/stream.c b/block/stream.c -index 97bee482dc..50093c9f57 100644 +index e45113aed6..c3c0c5febe 100644 --- a/block/stream.c +++ b/block/stream.c @@ -28,7 +28,7 @@ enum { diff --git a/debian/patches/pve/0045-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch b/debian/patches/pve/0045-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch index ff3ce42..6ea6267 100644 --- a/debian/patches/pve/0045-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch +++ b/debian/patches/pve/0045-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch @@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 4 insertions(+) diff --git a/block/io.c b/block/io.c -index f38e7f81d8..28c3a712b6 100644 +index bb0a254def..8c14e090d7 100644 --- a/block/io.c +++ b/block/io.c -@@ -1764,6 +1764,10 @@ static int bdrv_pad_request(BlockDriverState *bs, +@@ -1765,6 +1765,10 @@ static int bdrv_pad_request(BlockDriverState *bs, { int ret; diff --git a/debian/patches/pve/0046-block-add-alloc-track-driver.patch b/debian/patches/pve/0046-block-add-alloc-track-driver.patch index 15af532..71790d8 100644 --- a/debian/patches/pve/0046-block-add-alloc-track-driver.patch +++ b/debian/patches/pve/0046-block-add-alloc-track-driver.patch @@ -24,18 +24,20 @@ once the backing image is removed. It will be replaced by 'file'. Signed-off-by: Stefan Reiter Signed-off-by: Thomas Lamprecht +[adapt to changed function signatures] +Signed-off-by: Fabian Ebner --- - block/alloc-track.c | 345 ++++++++++++++++++++++++++++++++++++++++++++ + block/alloc-track.c | 350 ++++++++++++++++++++++++++++++++++++++++++++ block/meson.build | 1 + - 2 files changed, 346 insertions(+) + 2 files changed, 351 insertions(+) create mode 100644 block/alloc-track.c diff --git a/block/alloc-track.c b/block/alloc-track.c new file mode 100644 -index 0000000000..35f2737c89 +index 0000000000..6b50fbe537 --- /dev/null +++ b/block/alloc-track.c -@@ -0,0 +1,345 @@ +@@ -0,0 +1,350 @@ +/* + * Node to allow backing images to be applied to any node. Assumes a blank + * image to begin with, only new writes are tracked as allocated, thus this @@ -166,7 +168,7 @@ index 0000000000..35f2737c89 +} + +static int coroutine_fn track_co_preadv(BlockDriverState *bs, -+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) ++ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) +{ + BDRVAllocTrackState *s = bs->opaque; + QEMUIOVector local_qiov; @@ -177,6 +179,11 @@ index 0000000000..35f2737c89 + int64_t local_bytes; + bool alloc; + ++ if (offset < 0 || bytes < 0) { ++ fprintf(stderr, "unexpected negative 'offset' or 'bytes' value!\n"); ++ return -EINVAL; ++ } ++ + /* a read request can span multiple granularity-sized chunks, and can thus + * contain blocks with different allocation status - we could just iterate + * granularity-wise, but for better performance use bdrv_dirty_bitmap_next_X @@ -219,21 +226,21 @@ index 0000000000..35f2737c89 +} + +static int coroutine_fn track_co_pwritev(BlockDriverState *bs, -+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) ++ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) +{ + return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags); +} + +static int coroutine_fn track_co_pwrite_zeroes(BlockDriverState *bs, -+ int64_t offset, int count, BdrvRequestFlags flags) ++ int64_t offset, int64_t bytes, BdrvRequestFlags flags) +{ -+ return bdrv_co_pwrite_zeroes(bs->file, offset, count, flags); ++ return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags); +} + +static int coroutine_fn track_co_pdiscard(BlockDriverState *bs, -+ int64_t offset, int count) ++ int64_t offset, int64_t bytes) +{ -+ return bdrv_co_pdiscard(bs->file, offset, count); ++ return bdrv_co_pdiscard(bs->file, offset, bytes); +} + +static coroutine_fn int track_co_flush(BlockDriverState *bs) @@ -382,7 +389,7 @@ index 0000000000..35f2737c89 + +block_init(bdrv_alloc_track_init); diff --git a/block/meson.build b/block/meson.build -index e3ed5ac97c..d1ee260048 100644 +index 8c758c0218..45b72e10f1 100644 --- a/block/meson.build +++ b/block/meson.build @@ -2,6 +2,7 @@ block_ss.add(genh) diff --git a/debian/patches/series b/debian/patches/series index f2a3518..8462ec5 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,7 +1,9 @@ extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch extra/0002-monitor-hmp-add-support-for-flag-argument-with-value.patch extra/0003-monitor-refactor-set-expire_password-and-allow-VNC-d.patch -extra/0004-block-mirror-fix-NULL-pointer-dereference-in-mirror_.patch +extra/0004-block-rbd-fix-handling-of-holes-in-.bdrv_co_block_st.patch +extra/0005-block-rbd-workaround-for-ceph-issue-53784.patch +extra/0006-block-io-Update-BSC-only-if-want_zero-is-true.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 diff --git a/qemu b/qemu index 54e1f5b..44f28df 160000 --- a/qemu +++ b/qemu @@ -1 +1 @@ -Subproject commit 54e1f5be86dd11744e45da8be6afad01d01d59e7 +Subproject commit 44f28df24767cf9dca1ddc9b23157737c4cbb645 -- 2.30.2