backup: add patch to initialize bcs bitmap early enough for PBS

This is necessary for multi-disk backups where not all jobs are
immediately started after they are created. QEMU commit
06e0a9c16405c0a4c1eca33cf286cc04c42066a2 did already part of the work,
ensuring that new writes after job creation don't pass through to the
backup, but not yet for the MIRROR_SYNC_MODE_BITMAP case which is used
for PBS.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Fabian Ebner 2022-03-02 10:05:16 +01:00 committed by Wolfgang Bumiller
parent e050683663
commit 27199bd753
27 changed files with 86 additions and 27 deletions

View File

@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fabian Ebner <f.ebner@proxmox.com>
Date: Wed, 2 Mar 2022 08:35:05 +0100
Subject: [PATCH] block/backup: move bcs bitmap initialization to job creation
For backing up the state of multiple disks from the same time, a job
for each disk has to be created. It's convenient if the jobs don't
have to be started at the same time and if operation of the VM can be
resumed after job creation. This would lead to a window between job
creation and running the job, where writes can happen. But no writes
should happen between setting up the copy-before-write filter and
setting up the block copy state bitmap, because then new writes would
just pass through.
Commit 06e0a9c16405c0a4c1eca33cf286cc04c42066a2 moved initalization of
the bitmap to setting up the copy-before-write filter when sync_mode
is not MIRROR_SYNC_MODE_BITMAP. Ensure that the bitmap is initialized
upon job creation for the remaining case too, by moving the
backup_init_bcs_bitmap call to backup_job_create.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
block/backup.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index 21d5983779..47e218857d 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -239,8 +239,8 @@ static void backup_init_bcs_bitmap(BackupBlockJob *job)
assert(ret);
} else if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {
/*
- * We can't hog the coroutine to initialize this thoroughly.
- * Set a flag and resume work when we are able to yield safely.
+ * Initialization is costly here. Simply set a flag and let the
+ * backup_run coroutine resume work once it can yield safely.
*/
block_copy_set_skip_unallocated(job->bcs, true);
}
@@ -254,8 +254,6 @@ static int coroutine_fn backup_run(Job *job, Error **errp)
BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
int ret;
- backup_init_bcs_bitmap(s);
-
if (s->sync_mode == MIRROR_SYNC_MODE_TOP) {
int64_t offset = 0;
int64_t count;
@@ -493,6 +491,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
&error_abort);
+ backup_init_bcs_bitmap(job);
+
return &job->common;
error:

View File

@ -193,7 +193,7 @@ index 0000000000..93d7f46950
+ return bs; + return bs;
+} +}
diff --git a/block/backup.c b/block/backup.c diff --git a/block/backup.c b/block/backup.c
index 21d5983779..7d9aed1a60 100644 index 47e218857d..4d8fad70c4 100644
--- a/block/backup.c --- a/block/backup.c
+++ b/block/backup.c +++ b/block/backup.c
@@ -29,28 +29,6 @@ @@ -29,28 +29,6 @@
@ -225,7 +225,7 @@ index 21d5983779..7d9aed1a60 100644
static const BlockJobDriver backup_job_driver; static const BlockJobDriver backup_job_driver;
static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret) static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret)
@@ -457,6 +435,14 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, @@ -455,6 +433,14 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
} }
cluster_size = block_copy_cluster_size(bcs); cluster_size = block_copy_cluster_size(bcs);

51
debian/patches/series vendored
View File

@ -37,28 +37,29 @@ pve/0021-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
pve/0022-PVE-monitor-disable-oob-capability.patch pve/0022-PVE-monitor-disable-oob-capability.patch
pve/0023-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch pve/0023-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
pve/0024-PVE-Allow-version-code-in-machine-type.patch pve/0024-PVE-Allow-version-code-in-machine-type.patch
pve/0025-PVE-Backup-add-vma-backup-format-code.patch pve/0025-block-backup-move-bcs-bitmap-initialization-to-job-c.patch
pve/0026-PVE-Backup-add-backup-dump-block-driver.patch pve/0026-PVE-Backup-add-vma-backup-format-code.patch
pve/0027-PVE-Backup-proxmox-backup-patches-for-qemu.patch pve/0027-PVE-Backup-add-backup-dump-block-driver.patch
pve/0028-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch pve/0028-PVE-Backup-proxmox-backup-patches-for-qemu.patch
pve/0029-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch pve/0029-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
pve/0030-PVE-various-PBS-fixes.patch pve/0030-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch
pve/0031-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch pve/0031-PVE-various-PBS-fixes.patch
pve/0032-PVE-add-query_proxmox_support-QMP-command.patch pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
pve/0033-PVE-add-query-pbs-bitmap-info-QMP-call.patch pve/0033-PVE-add-query_proxmox_support-QMP-command.patch
pve/0034-PVE-redirect-stderr-to-journal-when-daemonized.patch pve/0034-PVE-add-query-pbs-bitmap-info-QMP-call.patch
pve/0035-PVE-Add-sequential-job-transaction-support.patch pve/0035-PVE-redirect-stderr-to-journal-when-daemonized.patch
pve/0036-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch pve/0036-PVE-Add-sequential-job-transaction-support.patch
pve/0037-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch pve/0037-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch
pve/0038-PVE-Migrate-dirty-bitmap-state-via-savevm.patch pve/0038-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch
pve/0039-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch pve/0039-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
pve/0040-PVE-fall-back-to-open-iscsi-initiatorname.patch pve/0040-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch
pve/0041-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch pve/0041-PVE-fall-back-to-open-iscsi-initiatorname.patch
pve/0042-PBS-add-master-key-support.patch pve/0042-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch
pve/0043-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch pve/0043-PBS-add-master-key-support.patch
pve/0044-PVE-block-stream-increase-chunk-size.patch pve/0044-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
pve/0045-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch pve/0045-PVE-block-stream-increase-chunk-size.patch
pve/0046-block-add-alloc-track-driver.patch pve/0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
pve/0047-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch pve/0047-block-add-alloc-track-driver.patch
pve/0048-PVE-savevm-async-register-yank-before-migration_inco.patch pve/0048-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch
pve/0049-qemu-img-dd-add-l-option-for-loading-a-snapshot.patch pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch
pve/0050-qemu-img-dd-add-l-option-for-loading-a-snapshot.patch