pve-qemu/debian
Fiona Ebner 0cffb504e7 backup: create jobs in a drained section
With the drive-backup QMP command, upstream QEMU uses a drained
section for the source drive when creating the backup job. Do the same
here to avoid subtle bugs.

There, the drained section extends until after the job is started, but
this cannot be done here for multi-disk backups (could at most start
the first job). The important thing is that the cbw
(copy-before-write) node is in place and the bcs (block-copy-state)
bitmap is initialized, which both happen during job creation (ensured
by the "block/backup: move bcs bitmap initialization to job creation"
PVE patch).

One such bug is one reported in the community forum [0], where using a
drive with iothread can lead to an overlapping block-copy request and
consequently an assertion failure. The block-copy code relies on the
bcs bitmap to determine if a request for a certain range can be
created. Each time a request is created, it resets the bcs bitmap at
that range to indicate that it's being handled.

The duplicate request can happen as follows:
Thread A attaches the cbw node
Thread B creates a request and resets the bitmap at that range
Thread A clears the bitmap and merges it with the PBS bitmap
The merging can lead to the bitmap being set again at the range of
the previous request, so the block-copy code thinks it's fine to
create a request there.
Thread B creates another requests at an overlapping range before the
other request is finished.

The drained section ensures that nothing else can interfere with the
bcs bitmap between attaching the copy-before-write block node and
initialization of the bitmap.

[0]: https://forum.proxmox.com/threads/133149/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-06 16:59:12 +02:00
..
patches backup: create jobs in a drained section 2023-09-06 16:59:12 +02:00
source buildsys: remove edk2 source tree when assembling build-dir 2023-05-24 10:37:10 +02:00
Logo.bmp import stable-4 build files 2017-04-05 11:39:09 +02:00
OVMF_CODE-pure-efi.fd import stable-4 build files 2017-04-05 11:39:09 +02:00
OVMF_README.txt import stable-4 build files 2017-04-05 11:39:09 +02:00
OVMF_VARS-pure-efi.fd import stable-4 build files 2017-04-05 11:39:09 +02:00
changelog bump version to 8.0.2-5 2023-08-16 11:56:49 +02:00
control d/control: drop obsolete build dependencies 2023-05-22 15:11:33 +02:00
copyright d/copyright: drop trailing whitespace 2022-04-22 09:16:23 +02:00
docs import stable-4 build files 2017-04-05 11:39:09 +02:00
kvm-ifdown import stable-4 build files 2017-04-05 11:39:09 +02:00
kvm-ifup update to 2.9.0-rc2 build files 2017-04-05 11:40:20 +02:00
parse-cpu-flags.pl Write recognized CPUID flags into static file 2019-10-17 13:39:21 +02:00
parse-machines.pl d/parse-machines: produce stable json output 2023-05-22 15:09:14 +02:00
pve-qemu-kvm.install debian: normalize packaging files with wrap-and-sort -tkn 2023-05-22 12:05:13 +02:00
pve-qemu-kvm.links debian: normalize packaging files with wrap-and-sort -tkn 2023-05-22 12:05:13 +02:00
pve-qemu-kvm.lintian-overrides d/lintian-overrides: ignore groff line breakage/adjustment warnings 2023-05-22 15:09:14 +02:00
rules buildsys: avoid handling noopt locally, rather extend CFLAGS 2023-05-23 14:09:12 +02:00