After my initial upstream submission [0], Stefan Hajnoczi suggested a different approach. But that approach [1] turned out to be rather involved, some work is still needed and discussion to be had. For now, pick the initial approach as a stop-gap.
[0]: https://lore.kernel.org/qemu-devel/[email protected]/T/ [1]: https://lore.kernel.org/qemu-devel/[email protected]/ Signed-off-by: Fiona Ebner <[email protected]> --- ...k-to-bounce-buffer-if-BLKZEROOUT-is-.patch | 36 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 37 insertions(+) create mode 100644 debian/patches/extra/0013-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch diff --git a/debian/patches/extra/0013-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch b/debian/patches/extra/0013-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch new file mode 100644 index 0000000..f71f5d2 --- /dev/null +++ b/debian/patches/extra/0013-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fiona Ebner <[email protected]> +Date: Mon, 5 Jan 2026 13:36:20 +0100 +Subject: [PATCH] block/io: fallback to bounce buffer if BLKZEROOUT is not + supported because of alignment + +Commit 5634622bcb ("file-posix: allow BLKZEROOUT with -t writeback") +enables the BLKZEROOUT ioctl when using 'writeback' cache, regressing +certain 'qemu-img convert' invocations, because of a pre-existing +issue. Namely, the BLKZEROOUT ioctl might fail with errno EINVAL when +the request is shorter than the block size of the block device. +Fallback to the bounce buffer, similar to when the ioctl is not +supported at all, rather than treating such an error as fatal. + +Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3257 +Resolves: https://bugzilla.proxmox.com/show_bug.cgi?id=7197 +Cc: [email protected] +Signed-off-by: Fiona Ebner <[email protected]> +--- + block/io.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/block/io.c b/block/io.c +index 9bd8ba8431..7b1ad0996a 100644 +--- a/block/io.c ++++ b/block/io.c +@@ -1917,7 +1917,8 @@ bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes, + assert(!bs->supported_zero_flags); + } + +- if (ret == -ENOTSUP && !(flags & BDRV_REQ_NO_FALLBACK)) { ++ if ((ret == -ENOTSUP || (ret == -EINVAL && num < alignment)) && ++ !(flags & BDRV_REQ_NO_FALLBACK)) { + /* Fall back to bounce buffer if write zeroes is unsupported */ + BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE; + diff --git a/debian/patches/series b/debian/patches/series index 99d9369..88cfb9b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -10,6 +10,7 @@ extra/0009-file-posix-populate-pwrite_zeroes_alignment.patch extra/0010-block-use-pwrite_zeroes_alignment-when-writing-first.patch extra/0011-block-io_uring-avoid-potentially-getting-stuck-after.patch extra/0012-block-mirror-check-range-when-setting-zero-bitmap-fo.patch +extra/0013-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.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.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
