You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/block
Stefan Hajnoczi d704a13d2c block: use pwrite_zeroes_alignment when writing first sector
Since commit 5634622bcb ("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.

Cc: qemu-stable@nongnu.org
Fixes: 5634622bcb ("file-posix: allow BLKZEROOUT with -t writeback")
Reported-by: Jean-Louis Dupond <jean-louis@dupond.be>
Buglink: https://gitlab.com/qemu-project/qemu/-/issues/3127
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20251007141700.71891-3-stefanha@redhat.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 week ago
..
export block/export: Add option to allow export of inactive nodes 10 months ago
monitor block/monitor: Use hmp_handle_error to report error 1 month ago
accounting.c block: enable stats-intervals for storage devices 1 month ago
aio_task.c block: Remove unused aio_task_pool_empty 1 year ago
amend.c block: Mark BlockDriver callbacks for amend job GRAPH_RDLOCK 3 years ago
backup.c block: add bdrv_graph_wrlock_drained() convenience wrapper 5 months ago
blkdebug.c block: Expand block status mode from bool to flags 7 months ago
blkio.c include/system: Move exec/memory.h to system/memory.h 8 months ago
blklogwrites.c block: add bdrv_graph_wrlock_drained() convenience wrapper 5 months ago
blkreplay.c blkreplay: Run BH in coroutine’s AioContext 2 weeks ago
blkverify.c block: add bdrv_graph_wrlock_drained() convenience wrapper 5 months ago
block-backend.c block: use pwrite_zeroes_alignment when writing first sector 1 week ago
block-copy.c include: Rename sysemu/ -> system/ 12 months ago
block-gen.h block-coroutine-wrapper.py: support also basic return types 3 years ago
block-ram-registrar.c include: Rename sysemu/ -> system/ 12 months ago
bochs.c block: replace TABs with space 3 weeks ago
cloop.c block: Take graph lock for most of .bdrv_open 2 years ago
commit.c block/commit: mark commit_abort() as GRAPH_UNLOCKED 5 months ago
copy-before-write.c block: Expand block status mode from bool to flags 7 months ago
copy-before-write.h blockdev-backup: Add error handling option for copy-before-write jobs 7 months ago
copy-on-read.c qapi: Move include/qapi/qmp/ to include/qobject/ 10 months ago
copy-on-read.h block: Mark bdrv_(un)freeze_backing_chain() and callers GRAPH_RDLOCK 2 years ago
coroutines.h block: Expand block status mode from bool to flags 7 months ago
create.c qemu/compiler: Absorb 'clang-tsa.h' 9 months ago
crypto.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
crypto.h block: Support detached LUKS header creation using qemu-img 2 years ago
curl.c curl: Fix coroutine waking 2 weeks ago
dirty-bitmap.c block: Mark bdrv_*_dirty_bitmap() and callers GRAPH_RDLOCK 3 years ago
dmg-bz2.c
dmg-lzfse.c block/dmg: Ignore C99 prototype declaration mismatch from <lzfse.h> 3 years ago
dmg.c block: Protect bs->file with graph_lock 2 years ago
dmg.h block/dmg: Declare a type definition for DMG uncompress function 3 years ago
file-posix.c file-posix: populate pwrite_zeroes_alignment 1 week ago
file-win32.c block: replace TABs with space 3 weeks ago
filter-compress.c block: Take graph lock for most of .bdrv_open 2 years ago
gluster.c gluster: Do not move coroutine into BDS context 2 weeks ago
graph-lock.c block: add bdrv_graph_wrlock_drained() convenience wrapper 5 months ago
io.c block/io: Take reqs_lock for tracked_requests 2 weeks ago
io_uring.c block/io_uring: use non-vectored read/write when possible 3 weeks ago
iscsi-opts.c modules: add block module annotations 4 years ago
iscsi.c iscsi: Create AIO BH in original AioContext 2 weeks ago
linux-aio.c block: skip automatic zero-init of large array in ioq_submit 6 months ago
meson.build include: Rename sysemu/ -> system/ 12 months ago
mirror.c block: drop wrapper for bdrv_set_backing_hd_drained() 5 months ago
nbd.c treewide: handle result of qio_channel_set_blocking() 3 months ago
nfs.c nfs: Run co BH CB in the coroutine’s AioContext 2 weeks ago
null.c null-aio: Run CB in original AioContext 2 weeks ago
nvme.c nvme: Note in which AioContext some functions run 2 weeks ago
parallels-ext.c qapi/crypto: Rename QCryptoHashAlgorithm to *Algo, and drop prefix 1 year ago
parallels.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
parallels.h block: Protect bs->file with graph_lock 2 years ago
preallocate.c block: Protect bs->file with graph_lock 2 years ago
progress_meter.c coroutine: Clean up superfluous inclusion of qemu/lockable.h 3 years ago
qapi-system.c qapi: Move include/qapi/qmp/ to include/qobject/ 10 months ago
qapi.c qemu-img info: Optionally show block limits 1 month ago
qcow.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
qcow2-bitmap.c block/qcow2-bitmap: Replace g_memdup() by g_memdup2() 2 years ago
qcow2-cache.c qcow2: Mark qcow2_signal_corruption() and callers GRAPH_RDLOCK 2 years ago
qcow2-cluster.c qcow2: put discards in discard queue when discard-no-unref is enabled 3 weeks ago
qcow2-refcount.c qcow2: put discards in discard queue when discard-no-unref is enabled 3 weeks ago
qcow2-snapshot.c include: Rename sysemu/ -> system/ 12 months ago
qcow2-threads.c thread-pool: avoid passing the pool parameter every time 3 years ago
qcow2.c qcow2: Schedule cache-clean-timer in realtime 2 weeks ago
qcow2.h qcow2: Fix cache_clean_timer 2 weeks ago
qed-check.c qed: mark more functions as coroutine_fns and GRAPH_RDLOCK 2 years ago
qed-cluster.c
qed-l2-cache.c osdep: Move memalign-related functions to their own header 4 years ago
qed-table.c block: use bdrv_co_debug_event in coroutine context 2 years ago
qed.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
qed.h block: Protect bs->file with graph_lock 2 years ago
quorum.c block: add bdrv_graph_wrlock_drained() convenience wrapper 5 months ago
raw-format.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
rbd.c rbd: Run co BH CB in the coroutine’s AioContext 2 weeks ago
replication.c block: mark bdrv_reopen_queue() and bdrv_reopen_multiple() as GRAPH_UNLOCKED 5 months ago
reqlist.c block/reqlist: allow adding overlapping requests 1 year ago
snapshot-access.c block: Expand block status mode from bool to flags 7 months ago
snapshot.c block: add bdrv_graph_wrlock_drained() convenience wrapper 5 months ago
ssh.c ssh: Run restart_coroutine in current AioContext 2 weeks ago
stream.c block/stream: mark stream_prepare() as GRAPH_UNLOCKED 5 months ago
throttle-groups.c qom: Make InterfaceInfo[] uses const 7 months ago
throttle.c block: Take graph lock for most of .bdrv_open 2 years ago
trace-events block/io_uring: use aio_add_sqe() 3 weeks ago
trace.h trace: switch position of headers to what Meson requires 5 years ago
vdi.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
vhdx-endian.c
vhdx-log.c vhdx: Take locks for accessing bs->file 2 years ago
vhdx.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
vhdx.h vhdx: Take locks for accessing bs->file 2 years ago
vmdk.c qcow2, vmdk: Restrict creation with secondary file using protocol 3 weeks ago
vpc.c block: Allow drivers to control protocol prefix at creation 3 weeks ago
vvfat.c block: Expand block status mode from bool to flags 7 months ago
win32-aio.c win32-aio: Run CB in original context 2 weeks ago
write-threshold.c block: remove AioContext locking 2 years ago