From d5f6ef56f0226b0efe34d6e08bfbad1706da3326 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Fri, 27 Jan 2023 09:13:35 +0100 Subject: [PATCH] add patch to fix issue with VirtIO disk using detect-zeroes=unmap 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 --- ...-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch | 36 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 37 insertions(+) create mode 100644 debian/patches/extra/0007-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch 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 index 0000000..7b7ea1e --- /dev/null +++ b/debian/patches/extra/0007-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +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 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 +--- + 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) { diff --git a/debian/patches/series b/debian/patches/series index f8e3fe8..06c775f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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