public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu] add patch to fix issue with VirtIO disk using detect-zeroes=unmap
Date: Fri, 27 Jan 2023 09:13:35 +0100	[thread overview]
Message-ID: <20230127081335.68488-1-f.ebner@proxmox.com> (raw)

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>
---
 ...-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 <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) {
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
-- 
2.30.2





             reply	other threads:[~2023-01-27  8:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27  8:13 Fiona Ebner [this message]
2023-01-27  9:47 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230127081335.68488-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal