All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/io: fallback to bounce buffer if BLKZEROOUT is not supported because of alignment
@ 2026-01-05 14:29 Fiona Ebner
  2026-01-05 19:10 ` Stefan Hajnoczi
  2026-06-01 17:17 ` Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Fiona Ebner @ 2026-01-05 14:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, qemu-stable, hreitz, kwolf, fam, stefanha

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: qemu-stable@nongnu.org
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 block/io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/io.c b/block/io.c
index cace297f22..e37d9d2417 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;
 
-- 
2.47.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-01 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 14:29 [PATCH] block/io: fallback to bounce buffer if BLKZEROOUT is not supported because of alignment Fiona Ebner
2026-01-05 19:10 ` Stefan Hajnoczi
2026-01-07 10:07   ` Fiona Ebner
2026-06-01 17:17 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.