On 02.10.25 21:39, Stefan Hajnoczi wrote:
Since commit 5634622bcb33 ("file-posix: allow BLKZEROOUT with -t
writeback"), qemu-img create errors out on a Linux loop block device
with a 4 KB sector size:

   # dd if=/dev/zero of=blockfile bs=1M count=1024
   # losetup --sector-size 4096 /dev/loop0 blockfile
   # qemu-img create -f raw /dev/loop0 1G
   Formatting '/dev/loop0', fmt=raw size=1073741824
   qemu-img: /dev/loop0: Failed to clear the new image's first sector: Invalid 
argument

Use the pwrite_zeroes_alignment block limit to avoid misaligned
fallocate(2) or ioctl(BLKZEROOUT) in the block/file-posix.c block
driver.

Fixes: 5634622bcb33 ("file-posix: allow BLKZEROOUT with -t writeback")
Reported-by: Jean-Louis Dupond<[email protected]>
Buglink:https://gitlab.com/qemu-project/qemu/-/issues/3127
Signed-off-by: Stefan Hajnoczi<[email protected]>


Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>

--
Best regards,
Vladimir

Reply via email to