]> git.proxmox.com Git - pve-qemu.git/commitdiff
add patch to fix issue with VirtIO disk using detect-zeroes=unmap
authorFiona Ebner <f.ebner@proxmox.com>
Fri, 27 Jan 2023 08:13:35 +0000 (09:13 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 27 Jan 2023 08:36:41 +0000 (09:36 +0100)
Affects Proxmox VE, when the discard disk setting is used for a
VirtIO disk.

Upstream bug report:
https://gitlab.com/qemu-project/qemu/-/issues/1404

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
debian/patches/extra/0007-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/extra/0007-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch b/debian/patches/extra/0007-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch
new file mode 100644 (file)
index 0000000..7b7ea1e
--- /dev/null
@@ -0,0 +1,36 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Stefan Hajnoczi <stefanha@redhat.com>
+Date: Thu, 26 Jan 2023 15:13:58 -0500
+Subject: [PATCH] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF
+
+When a write request is converted into a write zeroes request by the
+detect-zeroes= feature, it is no longer associated with an I/O buffer.
+The BDRV_REQ_REGISTERED_BUF flag doesn't make sense without an I/O
+buffer and must be cleared because bdrv_co_do_pwrite_zeroes() fails with
+-EINVAL when it's set.
+
+Fiona Ebner <f.ebner@proxmox.com> bisected and diagnosed this QEMU 7.2
+regression where writes containing zeroes to a blockdev with
+discard=unmap,detect-zeroes=unmap fail.
+
+Buglink: https://gitlab.com/qemu-project/qemu/-/issues/1404
+Fixes: e8b6535533be ("block: add BDRV_REQ_REGISTERED_BUF request flag")
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+---
+ block/io.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/block/io.c b/block/io.c
+index b9424024f9..bbaa0d1b2d 100644
+--- a/block/io.c
++++ b/block/io.c
+@@ -2087,6 +2087,9 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
+         if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) {
+             flags |= BDRV_REQ_MAY_UNMAP;
+         }
++
++        /* Can't use optimization hint with bufferless zero write */
++        flags &= ~BDRV_REQ_REGISTERED_BUF;
+     }
+     if (ret < 0) {
index f8e3fe883d85275cf06e5355b0bf94c5feb584bf..06c775f3e66a27f4b871a17791396b1735674155 100644 (file)
@@ -4,6 +4,7 @@ extra/0003-virtio-mem-Fix-the-bitmap-index-of-the-section-offse.patch
 extra/0004-virtio-mem-Fix-the-iterator-variable-in-a-vmem-rdl_l.patch
 extra/0005-vhost-fix-vq-dirty-bitmap-syncing-when-vIOMMU-is-ena.patch
 extra/0006-virtio-rng-pci-fix-migration-compat-for-vectors.patch
+extra/0007-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.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