Block layer patches
[PULL 1/8] virtio-blk: add missing VIRTIO_BLK_T_SCSI_CMD size check (CVE-2026-48914)
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
Check that the iovec containing struct virtio_scsi_inhdr is large enough before storing an error value there.
Feifan Qian <[email protected]> pointed out that this can be used to corrupt heap memory when the descriptor uses an MMIO address and a length of 1, forcing QEMU to allocate a 1-byte heap bounce buffer. virtio_stl_p() stores 4 bytes and therefore corrupts whatever is beyond the bounce buffer.
Message-ID: <[email protected]>
--- hw/block/virtio-blk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
hw/block/virtio-blk.c +7 -1
@@ -199,10 +199,16 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)/* * The scsi inhdr is placed in the second-to-last input segment, just -* before the regular inhdr. +* before the regular inhdr. VIRTIO implementations normally do not rely on +* the precise message framing, but legacy implementations did and so we do +* too for the legacy virtio-blk SCSI request type. * * Just put anything nonzero so that the ioctl fails in the guest. */ +if (elem->in_sg[elem->in_num -2 ].iov_len !=sizeof (*scsi)) { + status =VIRTIO_BLK_S_IOERR ; + goto fail; + } scsi = (void *)elem->in_sg[elem->in_num -2 ].iov_base;virtio_stl_p (vdev, &scsi->errors,255 ); status =VIRTIO_BLK_S_UNSUPP ;
Signature · 1 line
2.54.0
[PULL 4/8] qcow2: Fix data loss on zero write with detect-zeroes=unmap
In reply to Kevin WolfFrom: Thomas Lamprecht <[email protected]>
Commit b8bfb1478d ("qcow2: Fix corruption on discard during write with COW") added a wait_for_dependencies() at the start of qcow2_subcluster_zeroize(). That fixes the inconsistency it set out to fix, but turns the lock-protected pre-check in the caller, qcow2_co_pwrite_zeroes(), into a stale one: the wait yields s->lock, so an in-flight allocating write whose QCowL2Meta is already on s->cluster_allocs (but whose L2 entry is not yet linked) gets to link its entry during the yield. When the zeroize wakes, the cluster is now NORMAL, and with BDRV_REQ_MAY_UNMAP the free path in zero_in_l2_slice() unmaps the just-written cluster, silently dropping the data write's payload.
This is reachable with detect-zeroes=unmap (the default for VirtIO disks with discard on in Proxmox VE), under which the block layer auto-promotes all-zero buffers to BDRV_REQ_ZERO_WRITE | BDRV_REQ_MAY_UNMAP. A memory-constrained Debian guest running 'apt full-upgrade' on such a disk reproduces it as random SIGSEGVs:
swapped-out code pages come back as zero.
Wait for in-flight dependencies before the lock-protected check in qcow2_co_pwrite_zeroes(). If a write linked its L2 entry during the wait, the type check now fails and the block layer falls back to a bounce-buffered zero write that only touches the requested subrange, preserving the racing write's data. Promote wait_for_dependencies() to qcow2_wait_for_dependencies() so qcow2.c can call it.
Message-ID: <[email protected]>
--- block/qcow2.h | 4 ++++ block/qcow2-cluster.c | 10 +++++----- block/qcow2.c | 8 +++++++- tests/qemu-iotests/046 | 23 +++++++++++++++++++++++ tests/qemu-iotests/046.out | 10 ++++++++++ 5 files changed, 49 insertions(+), 6 deletions(-)
block/qcow2.h +4 -0
@@ -966,6 +966,10 @@ int coroutine_fn GRAPH_RDLOCK qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset, uint64_t bytes, int flags); +void coroutine_mixed_fn +qcow2_wait_for_dependencies (BlockDriverState *bs,uint64_t guest_offset, +uint64_t bytes); + int GRAPH_RDLOCK qcow2_expand_zero_clusters(BlockDriverState *bs, BlockDriverAmendStatusCB *status_cb,
block/qcow2-cluster.c +5 -5
@@ -1474,9 +1474,9 @@ static int coroutine_fn handle_dependencies(BlockDriverState *bs,return 0 ; } -static void coroutine_mixed_fn wait_for_dependencies(BlockDriverState *bs, -uint64_t guest_offset, -uint64_t bytes) +void coroutine_mixed_fn qcow2_wait_for_dependencies(BlockDriverState *bs, +uint64_t guest_offset, +uint64_t bytes) {BDRVQcow2State *s = bs->opaque;QCowL2Meta *m =NULL ;
@@ -2035,7 +2035,7 @@ int qcow2_cluster_discard(BlockDriverState *bs, uint64_t offset,* We don't need to allocate a QCowL2Meta for the discard operation because * s->lock is held for the duration of the whole operation. */ -wait_for_dependencies (bs, offset, bytes); +qcow2_wait_for_dependencies (bs, offset, bytes);/* Caller must pass aligned values, except at image end */ assert (QEMU_IS_ALIGNED (offset, s->cluster_size));
@@ -2204,7 +2204,7 @@ int coroutine_fn qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,* We don't need to allocate a QCowL2Meta for the zeroize operation because * s->lock is held for the duration of the whole operation. */ -wait_for_dependencies (bs, offset, bytes); +qcow2_wait_for_dependencies (bs, offset, bytes);/* If we have to stay in sync with an external data file, zero out * s->data_file first. */
block/qcow2.c +7 -1
@@ -4234,10 +4234,16 @@ qcow2_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes, }qemu_co_mutex_lock (&s->lock); -/* We can have new write after previous check */ offset -= head; bytes = s->subcluster_size; nr = s->subcluster_size; +/* +* Wait for in-flight allocating writes first: otherwise the type +* check below could pass on UNALLOCATED while a yet-to-link_l2 write +* completes during qcow2_subcluster_zeroize()'s own wait, letting the +* resumed MAY_UNMAP discard the just-written data. +*/ +qcow2_wait_for_dependencies (bs, offset, bytes); ret =qcow2_get_host_offset (bs, offset, &nr, &off, &type); if (ret < 0 || (type != QCOW2_SUBCLUSTER_UNALLOCATED_PLAIN &&
tests/qemu-iotests/046 +23 -0
@@ -226,6 +226,26 @@ aio_write -z 0x140000 0x10000 resume A aio_flush EOF + +# Start an allocating write to a previously unallocated cluster and, before +# its L2 update is linked, issue a concurrent sub-cluster zero write with +# MAY_UNMAP that targets a disjoint range within the same cluster. The zero +# write's head/tail are zero (cluster is unallocated), so qcow2_co_pwrite_zeroes +# would expand it to the full subcluster. Without waiting for dependencies +# before the zero write's "unallocated" type check, that check passes, +# qcow2_subcluster_zeroize then yields in wait_for_dependencies, the allocating +# write links its L2 entry, and the resumed zeroize unmaps the cluster - +# silently discarding the just-written data. Waiting first makes the zero write +# fall back to a bounce-buffered real write, which only touches its own +# subrange. +cat <<EOF +break write_aio A +aio_write -P 180 0x200000 0x4000 +wait_break A +aio_write -z -u 0x204000 0x4000 +resume A +aio_flush +EOF } overlay_io | $QEMU_IO blkdebug::"$TEST_IMG" | _filter_qemu_io |\
@@ -310,6 +330,9 @@ verify_io() echo read -P 0 0x120000 0x10000 echo read -P 0 0x130000 0x10000 echo read -P 0 0x140000 0x10000 + + echo read -P 180 0x200000 0x4000 + echo read -P 0 0x204000 0xc000 } verify_io | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
tests/qemu-iotests/046.out +10 -0
@@ -169,6 +169,12 @@ wrote XXX/XXX bytes at offset XXX XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote XXX/XXX bytes at offset XXX XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +blkdebug: Suspended request 'A' +blkdebug: Resuming request 'A' +wrote XXX/XXX bytes at offset XXX +XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote XXX/XXX bytes at offset XXX +XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == Verify image content == read 65536/65536 bytes at offset 0
@@ -275,5 +281,9 @@ read 65536/65536 bytes at offset 1245184 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 1310720 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 16384/16384 bytes at offset 2097152 +16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 49152/49152 bytes at offset 2113536 +48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) No errors were found on the image. *** done
Signature · 1 line
2.54.0
[PULL 6/8] block/export/fuse: set FUSE_DIRECT_IO_ALLOW_MMAP flag to fix regression
In reply to Kevin WolfFrom: Fiona Ebner <[email protected]>
Commit 8599559580 ("fuse: Set direct_io and parallel_direct_writes") broke use cases that require mmap() with MAP_SHARED on the export. In particular, swtpm_setup using its 'file://' protocol requires this. From the kernel documentation [0]:
Quoted 2 lines
To allow shared mmap, the
FUSE_DIRECT_IO_ALLOW_MMAPflag may be enabled in theFUSE_INITreply.
Set the FUSE_DIRECT_IO_ALLOW_MMAP flag to restore compatibility with users requiring shared mmap. The FUSE_INIT_EXT flag needs to be set for the flags2 member to have an effect.
[0]: https://www.kernel.org/doc/html/next/filesystems/fuse/fuse-io.html
Message-ID: <[email protected]>
--- block/export/fuse.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
block/export/fuse.c +11 -2
@@ -856,7 +856,8 @@ static ssize_t coroutine_fn GRAPH_RDLOCK fuse_co_init(FuseExport *exp, struct fuse_init_out *out, const struct fuse_init_in *in) { -const uint32_t supported_flags =FUSE_ASYNC_READ |FUSE_ASYNC_DIO ; +uint32_t supported_flags =FUSE_ASYNC_READ |FUSE_ASYNC_DIO ; +uint32_t flags2 =0 ;if (in->major !=7 ) { error_report("FUSE major version mismatch: We have 7, but kernel has %"
@@ -871,13 +872,21 @@ fuse_co_init(FuseExport *exp, struct fuse_init_out *out,return -EINVAL ; } +if (!using_old_fuse_init_in (in)) { +/* The flags2 flags must be shifted down by 32 bits. */ +const uint32_t supported_flags2 =FUSE_DIRECT_IO_ALLOW_MMAP >>32 ; +/* flags2 is only considered if FUSE_INIT_EXT is set. */ + supported_flags = supported_flags |FUSE_INIT_EXT ; + flags2 = in->flags2 & supported_flags2; + } + *out = (struct fuse_init_out ) { .major =7 , .minor =MIN (FUSE_KERNEL_MINOR_VERSION , in->minor), .max_readahead = in->max_readahead, .max_write =FUSE_MAX_WRITE_BYTES , .flags = in->flags & supported_flags, - .flags2 =0 , + .flags2 = flags2,/* libfuse maximum: 2^16 - 1 */ .max_background =UINT16_MAX ,
Signature · 1 line
2.54.0
The following changes since commit cc329c491768b2d91eb0b0984f3baa0bf805776d:
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2026-06-08 09:30:30 -0400)
are available in the Git repository at:
https://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 296b66d05bac7eb2b86600febdbd2bd8d410f026:
qed: Don't try to flush during incoming migration (2026-06-08 17:00:47 +0200)
----------------------------------------------------------------
Block layer patches
- qcow2: Fix data loss on zero write with detect-zeroes=unmap
- qemu-img bitmap: add sub-command --remove-all
- export/fuse: set FUSE_DIRECT_IO_ALLOW_MMAP flag to fix regression
- virtio-blk: add missing VIRTIO_BLK_T_SCSI_CMD size check (CVE-2026-48914)
- qed: Don't try to flush during incoming migration
- iotests/136: Test stats-intervals with -blockdev/-device
----------------------------------------------------------------
Denis V. Lunev (1):
qemu-img: add sub-command --remove-all to 'qemu-img bitmap'
Fabiano Rosas (1):
qed: Don't try to flush during incoming migration
Fiona Ebner (3):
block/export/fuse: use struct fuse_init_in block/export/fuse: set FUSE_DIRECT_IO_ALLOW_MMAP flag to fix regression
iotests: test shared mmap for fuse export
Kevin Wolf (1):
iotests/136: Test stats-intervals with -blockdev/-device
Stefan Hajnoczi (1):
virtio-blk: add missing VIRTIO_BLK_T_SCSI_CMD size check (CVE-2026-48914)
Thomas Lamprecht (1):
qcow2: Fix data loss on zero write with detect-zeroes=unmap
docs/tools/qemu-img.rst | 10 ++- block/qcow2.h | 4 + block/export/fuse.c | 69 +++++++++++++---- block/qcow2-cluster.c | 10 +-- block/qcow2.c | 8 +- block/qed.c | 16 ++-- hw/block/virtio-blk.c | 8 +- qemu-img.c | 55 ++++++++++++-- tests/qemu-iotests/046 | 23 ++++++ tests/qemu-iotests/046.out | 10 +++ tests/qemu-iotests/136 | 87 +++++++++++++++++++--- tests/qemu-iotests/136.out | 4 +- tests/qemu-iotests/tests/fuse-mmap-shared | 103 ++++++++++++++++++++++++++ tests/qemu-iotests/tests/fuse-mmap-shared.out | 5 ++ tests/qemu-iotests/tests/qemu-img-bitmaps | 24 ++++++ tests/qemu-iotests/tests/qemu-img-bitmaps.out | 46 ++++++++++++ 16 files changed, 430 insertions(+), 52 deletions(-) create mode 100755 tests/qemu-iotests/tests/fuse-mmap-shared create mode 100644 tests/qemu-iotests/tests/fuse-mmap-shared.out
[PULL 5/8] block/export/fuse: use struct fuse_init_in
From: Fiona Ebner <[email protected]>
The code is switched to use the current 'struct fuse_init_in' in preparation to use the FUSE_DIRECT_IO_ALLOW_MMAP feature, which is part of the flags2 member that got added in protocol version 5.36.
To not break compatibility with older kernels, the check for whether the full header of an operation was read in co_read_from_fuse_fd() needs to be adapted. In particular, for a FUSE_INIT operation, the protocol version must be considered, because the length of the header changed with protocol version 7.36. Always using the length of the old, shorter struct was inaccurate, since for newer protocol versions this might mean accepting a truncated read for FUSE_INIT.
Users of the init header that want to use parts of the extended structure must check with the using_old_fuse_init_in() helper function if they may do so.
Message-ID: <[email protected]>
--- block/export/fuse.c | 56 +++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 14 deletions(-)
block/export/fuse.c +42 -14
@@ -51,23 +51,16 @@#define FUSE_MAX_READ_BYTES (MIN(BDRV_REQUEST_MAX_BYTES, 1 * 1024 * 1024))#define FUSE_MAX_WRITE_BYTES (64 * 1024) -/* -* fuse_init_in structure before 7.36. We don't need the flags2 field added -* there, so we can work with the smaller older structure to stay compatible -* with older kernels. -*/ -struct fuse_init_in_compat { -uint32_t major; -uint32_t minor; -uint32_t max_readahead; -uint32_t flags; -}; - typedef struct FuseRequestInHeader { struct fuse_in_header common; /* All supported requests */ union { - struct fuse_init_in_compat init; + /* + * When using_old_fuse_init_in() is true, then the smaller older struct + * is used by the kernel. The flags2 member and other new members must + * be treated as absent then. + */ + struct fuse_init_in init; struct fuse_open_in open; struct fuse_setattr_in setattr; struct fuse_read_in read;
@@ -629,6 +622,16 @@ static int clone_fuse_fd(int fd, Error **errp)return new_fd; } +/** +* Check whether the smaller older fuse_init_in structure from before protocol +* version 7.36 is used. The flags2 member and other new members must be treated +* as absent then. +*/ +static bool using_old_fuse_init_in (const struct fuse_init_in *in) +{ +return in->major <7 || (in->major ==7 && in->minor <36 ); +} +/** * Try to read a single request from the FUSE FD. * Takes a FuseQueue pointer in `opaque`.
@@ -693,6 +696,31 @@ static void coroutine_fn co_read_from_fuse_fd(void *opaque) goto no_request; } +/* +* If the request is of type FUSE_INIT, need to check the version to +* actually determine the length of the fuse_init_in structure used by the +* kernel. In protocol version 7.36, the structure was extended. +*/ +if (in_hdr->common.opcode ==FUSE_INIT ) { +/* Length of the fuse_init_in structure before 7.36. */ +size_t old_init_hdr_len =16 ; + +/* +* Expect at least the size of the smaller older structure to ensure the +* version can be checked. +*/ +if (unlikely (ret <sizeof (in_hdr->common) + old_init_hdr_len)) { +error_report ("FUSE_INIT request truncated, read only %zi bytes" , + ret); +fuse_write_err (fuse_fd, &in_hdr->common, -EINVAL ); + goto no_request; + } + +if (using_old_fuse_init_in (&in_hdr->init)) { + op_hdr_len = old_init_hdr_len; + } + } +if (unlikely (ret <sizeof (in_hdr->common) + op_hdr_len)) { error_report("FUSE request truncated, expected %zu bytes, read %zi " "bytes",
@@ -826,7 +854,7 @@ static bool is_regular_file(const char *path, Error **errp)*/ static ssize_t coroutine_fn GRAPH_RDLOCKfuse_co_init (FuseExport *exp,struct fuse_init_out *out, -const struct fuse_init_in_compat *in) +const struct fuse_init_in *in) {const uint32_t supported_flags =FUSE_ASYNC_READ |FUSE_ASYNC_DIO ;
Signature · 1 line
2.54.0
[PULL 3/8] iotests/136: Test stats-intervals with -blockdev/-device
In reply to Kevin WolfCommit 9f0c763e introduced the "stats-intervals" qdev property for block devices, a setting that was previously only accessible with -drive. Extend the corresponding test to include test cases that set the property on -device instead, both with -drive and -blockdev.
We wouldn't really improve coverage with testing every combination of account_invalid and account_failed with all modes to set up statistics, so it seems good enough to test all combinations with the old way, and only both True or both False with the additional ways.
Message-ID: <[email protected]>
--- tests/qemu-iotests/136 | 87 ++++++++++++++++++++++++++++++++------ tests/qemu-iotests/136.out | 4 +- 2 files changed, 77 insertions(+), 14 deletions(-)
tests/qemu-iotests/136 +75 -12
@@ -22,6 +22,7 @@ import iotests import os +import json interval_length = 10 nsec_per_sec = 1000000000
@@ -45,14 +46,22 @@ class BlockDeviceStatsTestCase(iotests.QMPTestCase): wr_highest_offset = 0 account_invalid = False account_failed = False + stats_in_device = False + use_blockdev = False def blockstats(self, device): result = self.vm.qmp("query-blockstats") for r in result['return']: - if r['device'] == device: + if r['device'] == device or r['node-name'] == device: return r['stats'] raise Exception("Device not found for blockstats: %s" % device) + def qemu_io(self, cmd): + if self.use_blockdev: + self.vm.hmp_qemu_io("virtio0/virtio-backend", cmd, qdev=True) + else: + self.vm.hmp_qemu_io("drive0", cmd) + def create_blkdebug_file(self): file = open(blkdebug_file, 'w') file.write('''
@@ -73,17 +82,54 @@ sector = "%d" @iotests.skip_if_unsupported(required_drivers) def setUp(self): - drive_args = [] - drive_args.append("stats-intervals.0=%d" % interval_length) - drive_args.append("stats-account-invalid=%s" % - (self.account_invalid and "on" or "off")) - drive_args.append("stats-account-failed=%s" % - (self.account_failed and "on" or "off")) - drive_args.append("file.image.read-zeroes=on") self.create_blkdebug_file() - self.vm = iotests.VM().add_drive('blkdebug:%s:%s://' % - (blkdebug_file, self.test_driver), - ','.join(drive_args)) + self.vm = iotests.VM() + + drive_args = [ + "file.image.read-zeroes=on", + ] + if self.stats_in_device: + interface = "none" + dev_args = { + "driver": "virtio-blk", + "id": "virtio0", + "drive": "drive0", + "stats-intervals": [ interval_length ], + "account-invalid": "on" if self.account_invalid else "off", + "account-failed": "on" if self.account_failed else "off", + } + self.vm.add_device(json.dumps(dev_args)) + else: + assert not self.use_blockdev + interface = "virtio" + drive_args += [ + "stats-intervals.0=%d" % interval_length, + "stats-account-invalid=%s" % + (self.account_invalid and "on" or "off"), + "stats-account-failed=%s" % + (self.account_failed and "on" or "off"), + ] + + if self.use_blockdev: + blockdev_args = { + "node-name": "drive0", + "driver": "raw", + "file": { + "driver": "blkdebug", + "config": blkdebug_file, + "image": { + "driver": self.test_driver, + "read-zeroes": True, + }, + }, + } + self.vm.add_blockdev(json.dumps(blockdev_args)) + else: + self.vm.add_drive('blkdebug:%s:%s://' % + (blkdebug_file, self.test_driver), + ','.join(drive_args), + interface=interface) + self.vm.launch() # Set an initial value for the clock self.vm.qtest("clock_step %d" % nsec_per_sec)
@@ -261,7 +307,7 @@ sector = "%d" # Now perform all operations for op in ops: - self.vm.hmp_qemu_io("drive0", op) + self.qemu_io(op) # Update the expected totals self.total_rd_bytes += rd_ops * rd_size
@@ -328,6 +374,12 @@ sector = "%d" # All values must be sane before doing any I/O self.check_values() +class BlockDeviceStatsTestDevice(BlockDeviceStatsTestCase): + stats_in_device = True + +class BlockDeviceStatsTestBlockdev(BlockDeviceStatsTestCase): + stats_in_device = True + use_blockdev = True class BlockDeviceStatsTestAccountInvalid(BlockDeviceStatsTestCase): account_invalid = True
@@ -341,6 +393,17 @@ class BlockDeviceStatsTestAccountBoth(BlockDeviceStatsTestCase): account_invalid = True account_failed = True +class BlockDeviceStatsTestAccountBothDevice(BlockDeviceStatsTestCase): + account_invalid = True + account_failed = True + stats_in_device = True + +class BlockDeviceStatsTestAccountBothBlockdev(BlockDeviceStatsTestCase): + account_invalid = True + account_failed = True + stats_in_device = True + use_blockdev = True + class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTestCase): test_driver = "null-co"
tests/qemu-iotests/136.out +2 -2
@@ -1,5 +1,5 @@ -................................... +............................................................... ---------------------------------------------------------------------- -Ran 35 tests +Ran 63 tests OK
Signature · 1 line
2.54.0
[PULL 8/8] qed: Don't try to flush during incoming migration
In reply to Kevin WolfFrom: Fabiano Rosas <[email protected]>
It's not possible to access the image file while there is an incoming migration in progress, the QEMU process doesn't hold any locks to the storage at this point so nodes are inactive. Attempting to flush leads to an assert at bdrv_co_write_req_prepare():
assert(!(bs->open_flags & BDRV_O_INACTIVE))
The issue is reproducible by running iotest 181 on a host under cpu load. The migration must coincide with the header already containing the QED_F_NEED_CHECK flag.
The sequence of events is as follows, with the respective call stacks referenced below:
During block device init, bdrv_qed_attach_aio_context() starts the 'need_check' timer. The timer will not fire during incoming migration as it uses QEMU_CLOCK_VIRTUAL (to avoid this very issue, as the code
comment indicates). (0)
However, there's still bdrv_qed_drain_begin() which uses the fact that the timer is live to decide whether to start theqed_need_check_timer_entry() directly. (1)
The qed_need_check_timer_entry() eventually calls intoqed_write_header() -> bdrv_co_pwrite() leading to the assert. (2)
Skip creating the 'need_check' timer whenever the image is inactive.
The stacks:
(0) == issues timer_mod ==
#6 in qed_start_need_check_timer at ../block/qed.c:340 #7 in bdrv_qed_attach_aio_context at ../block/qed.c:373 #8 in bdrv_qed_do_open at ../block/qed.c:556 #9 in bdrv_qed_open_entry at ../block/qed.c:582 #10 in coroutine_trampoline at ../util/coroutine-ucontext.c:175 #0 in qemu_coroutine_switch<+120> at ../util/coroutine-ucontext.c:321 #1 in qemu_aio_coroutine_enter<+356> at ../util/qemu-coroutine.c:293 #2 in aio_co_enter<+179> at ../util/async.c:710 #3 in aio_co_wake<+53> at ../util/async.c:695 #4 in thread_pool_co_cb<+47> at ../util/thread-pool.c:283 #5 in thread_pool_completion_bh<+241> at ../util/thread-pool.c:202 #6 in aio_bh_call<+109> at ../util/async.c:173 #7 in aio_bh_poll<+299> at ../util/async.c:220 #8 in aio_poll<+690> at ../util/aio-posix.c:745 #9 in bdrv_qed_open<+392> at ../block/qed.c:607 #10 in bdrv_open_driver<+327> at ../block.c:1678 #11 in bdrv_open_common<+1619> at ../block.c:2008 #12 in bdrv_open_inherit<+2556> at ../block.c:4191 #13 in bdrv_open<+118> at ../block.c:4286 #14 in blk_new_open<+199> at ../block/block-backend.c:458 #15 in blockdev_init<+2011> at ../blockdev.c:612 #16 in drive_new<+3008> at ../blockdev.c:1008 #17 in drive_init_func<+51> at ../system/vl.c:662 #18 in qemu_opts_foreach<+227> at ../util/qemu-option.c:1148 #19 in configure_blockdev<+350> at ../system/vl.c:721
#20 in qemu_create_early_backends<+343> at ../system/vl.c:2076
#21 in qemu_init<+12483> at ../system/vl.c:3778
#22 in main<+46> at ../system/main.c:71
(1) == sees timer_pending ==
#6 in bdrv_qed_drain_begin at ../block/qed.c:391 #7 in bdrv_do_drained_begin at ../block/io.c:366 #8 in bdrv_do_drained_begin_quiesce at ../block/io.c:386 #9 in bdrv_child_cb_drained_begin at ../block.c:1207 #10 in bdrv_parent_drained_begin_single at ../block/io.c:133 #11 in bdrv_parent_drained_begin at ../block/io.c:64 #12 in bdrv_do_drained_begin at ../block/io.c:364 #13 in bdrv_drained_begin at ../block/io.c:393 #14 in blk_drain at ../block/block-backend.c:2101 #15 in blk_unref at ../block/block-backend.c:544 #16 in bdrv_open_inherit at ../block.c:4197 #17 in bdrv_open at ../block.c:4286 #18 in blk_new_open at ../block/block-backend.c:458 #19 in blockdev_init at ../blockdev.c:612 #20 in drive_new at ../blockdev.c:1008 #21 in drive_init_func at ../system/vl.c:662 #22 in qemu_opts_foreach at ../util/qemu-option.c:1148 #23 in configure_blockdev at ../system/vl.c:721 #24 in qemu_create_early_backends at ../system/vl.c:2076 #25 in qemu_init at ../system/vl.c:3778 #26 in main at ../system/main.c:71
(2) == crashes ==
#5 in __assert_fail (assertion="!(bs->open_flags & BDRV_O_INACTIVE)", file="../block/io.c", line=1977 #6 in bdrv_co_write_req_prepare at ../block/io.c:1977 #7 in bdrv_aligned_pwritev at ../block/io.c:2099 #8 in bdrv_co_pwritev_part at ../block/io.c:2316 #9 in bdrv_co_pwritev at ../block/io.c:2233 #10 in bdrv_co_pwrite at ../include/block/block_int-io.h:77 #11 in qed_write_header at ../block/qed.c:128 #12 in qed_need_check_timer at ../block/qed.c:305
#13 in qed_need_check_timer_entry at ../block/qed.c:319
Note that this issue is not exactly the same as what's been reported in Gitlab, but given how easily this reproduces, I imagine it has to be happening in that setup as well.
Message-ID: <[email protected]>
--- block/qed.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
block/qed.c +11 -5
@@ -351,16 +351,22 @@ static void bdrv_qed_detach_aio_context(BlockDriverState *bs) {BDRVQEDState *s = bs->opaque; -qed_cancel_need_check_timer (s); -timer_free (s->need_check_timer); - s->need_check_timer =NULL ; +if (s->need_check_timer) { +qed_cancel_need_check_timer (s); +timer_free (s->need_check_timer); + s->need_check_timer =NULL ; + } } -static void bdrv_qed_attach_aio_context (BlockDriverState *bs, -AioContext *new_context) +static void GRAPH_RDLOCK bdrv_qed_attach_aio_context(BlockDriverState *bs, +AioContext *new_context) {BDRVQEDState *s = bs->opaque; +if (bdrv_is_inactive (bs)) { +return ; + } + s->need_check_timer =aio_timer_new (new_context,QEMU_CLOCK_VIRTUAL ,SCALE_NS , qed_need_check_timer_cb, s);
Signature · 1 line
2.54.0
[PULL 7/8] iotests: test shared mmap for fuse export
In reply to Kevin WolfFrom: Fiona Ebner <[email protected]>
This test would have worked before commit 8599559580 ("fuse: Set direct_io and parallel_direct_writes") and is working again since commit HEAD~1 ("block/export/fuse: set FUSE_DIRECT_IO_ALLOW_MMAP flag to fix regression").
Message-ID: <[email protected]>
--- tests/qemu-iotests/tests/fuse-mmap-shared | 103 ++++++++++++++++++ tests/qemu-iotests/tests/fuse-mmap-shared.out | 5 + 2 files changed, 108 insertions(+) create mode 100755 tests/qemu-iotests/tests/fuse-mmap-shared create mode 100644 tests/qemu-iotests/tests/fuse-mmap-shared.out
tests/qemu-iotests/tests/fuse-mmap-shared new file +103 -0
@@ -0,0 +1,103 @@ +#!/usr/bin/env python3 +# group: rw +# +# Test that a FUSE export can be mmap()-ed with MAP_SHARED +# +# Copyright (C) 2026 Proxmox Server Solutions GmbH +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import itertools +import mmap +from mmap import MAP_SHARED +from pathlib import Path + +import iotests +from iotests import qemu_img, qemu_io, QemuStorageDaemon + +def test_fuse_support(mount_point): + test_qsd = QemuStorageDaemon('--blockdev', 'null-co,node-name=node0', + qmp=True) + res = test_qsd.qmp('block-export-add', { + 'id': 'exp0', + 'type': 'fuse', + 'node-name': 'node0', + 'mountpoint': mount_point, + 'allow-other': 'off' + }) + test_qsd.stop() + if 'error' in res: + assert (res['error']['desc'] == + "Parameter 'type' does not accept value 'fuse'") + iotests.notrun('No FUSE support') + +# Shared mmap when using direct IO is only supported for Linux kernels >= 6.6 +# with commit e78662e818f94 ("fuse: add a new fuse init flag to relax +# estrictions in no cache mode"). +def test_linux_kernel_support(): + [major, minor] = map(int, os.uname().release.split('.')[:2]) + if major < 6 or (major == 6 and minor < 6): + iotests.notrun('No kernel support for shared mmap with direct IO') + +image_size = 1 * 1024 * 1024 +image = os.path.join(iotests.test_dir, 'image.' + iotests.imgfmt) +fuse_mount_point = os.path.join(iotests.test_dir, 'export.fuse') +Path(fuse_mount_point).touch() + +test_fuse_support(fuse_mount_point) +test_linux_kernel_support() + +class TestMmapShared(iotests.QMPTestCase): + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, image, str(image_size)) + qemu_io(image, '-c', f'write -P 23 0 {image_size}') + + self.qsd = QemuStorageDaemon(qmp=True) + + self.qsd.cmd('blockdev-add', { + 'node-name': 'node0', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': image + } + }) + + self.qsd.cmd('block-export-add', { + 'id': 'exp0', + 'type': 'fuse', + 'node-name': 'node0', + 'mountpoint': fuse_mount_point, + 'writable': True, + 'allow-other': 'off' + }) + + def tearDown(self): + self.stop_qsd() + os.remove(image) + os.remove(fuse_mount_point) + + def stop_qsd(self): + if self.qsd: + self.qsd.stop() + self.qsd = None + + def test_mmap_shared(self): + with open(fuse_mount_point, 'r+b') as file: + with mmap.mmap(file.fileno(), image_size, flags=MAP_SHARED) as mm: + buf = bytearray(image_size) + buf[:] = itertools.repeat(23, image_size) + assert mm.read(image_size) == buf + buf[:] = itertools.repeat(42, image_size) + mm.seek(0) + mm.write(buf) + mm.flush() + self.stop_qsd() + qemu_io(image, '-c', f'read -P 42 0 {image_size}') + +if __name__ == '__main__': + iotests.main(supported_fmts=['generic'], + supported_protocols=['file'], + supported_platforms=['linux'])
tests/qemu-iotests/tests/fuse-mmap-shared.out new file +5 -0
@@ -0,0 +1,5 @@ +. +---------------------------------------------------------------------- +Ran 1 tests + +OK
Signature · 1 line
2.54.0
[PULL 2/8] qemu-img: add sub-command --remove-all to 'qemu-img bitmap'
In reply to Kevin WolfFrom: "Denis V. Lunev" <[email protected]>
From time to time it is needed to remove all bitmaps from the image. Before this patch the process is not very convenient. One should perform
qemu-img info
and parse the output to obtain all names. After that one should sequentially call
qemu-img bitmap --remove
for each present bitmap.
The patch adds --remove-all sub-command to 'qemu-img bitmap'. The new sub-command also composes with other bitmap actions in the same invocation, so a common "wipe and recreate" workflow can be expressed as
qemu-img bitmap --remove-all --add NEW FILE
instead of enumerating existing bitmaps, removing them one by one, and only then adding the fresh one.
Message-ID: <[email protected]>
--- docs/tools/qemu-img.rst | 10 +++- qemu-img.c | 55 ++++++++++++++++--- tests/qemu-iotests/tests/qemu-img-bitmaps | 24 ++++++++ tests/qemu-iotests/tests/qemu-img-bitmaps.out | 46 ++++++++++++++++ 4 files changed, 125 insertions(+), 10 deletions(-)
docs/tools/qemu-img.rst +7 -3
@@ -301,15 +301,19 @@ Command description: For write tests, by default a buffer filled with zeros is written. This can be overridden with a pattern byte specified by *PATTERN*. -.. option:: bitmap (--merge SOURCE | --add | --remove | --clear | --enable | --disable)... [-b SOURCE_FILE [-F SOURCE_FMT]] [-g GRANULARITY] [--object OBJECTDEF] [--image-opts | -f FMT] FILENAME BITMAP +.. option:: bitmap (--merge SOURCE | --add | --remove | --remove-all | --clear | --enable | --disable)... [-b SOURCE_FILE [-F SOURCE_FMT]] [-g GRANULARITY] [--object OBJECTDEF] [--image-opts | -f FMT] FILENAME [BITMAP] - Perform one or more modifications of the persistent bitmap *BITMAP* - in the disk image *FILENAME*. The various modifications are: + Perform one or more modifications of persistent bitmaps in the disk + image *FILENAME*. Most operations require *BITMAP* to be specified; + ``--remove-all`` operates on all bitmaps and does not take *BITMAP*. + The various modifications are: ``--add`` to create *BITMAP*, enabled to record future edits. ``--remove`` to remove *BITMAP*. + ``--remove-all`` to remove all bitmaps. + ``--clear`` to clear *BITMAP*. ``--enable`` to change *BITMAP* to start recording future edits.
qemu-img.c +48 -7
146 lines not on this page · raw message
tests/qemu-iotests/tests/qemu-img-bitmaps +24 -0
@@ -161,6 +161,30 @@ $QEMU_IMG convert --bitmaps -O qcow2 "$TEST_IMG" "$TEST_IMG.copy" TEST_IMG="$TEST_IMG.copy" _img_info --format-specific \ | _filter_irrelevant_img_info +echo +echo "=== Check --remove-all ===" +echo + +# Start from a fresh image so prior state does not bleed into the assertions +_rm_test_img "$TEST_IMG" +_make_test_img 10M +$QEMU_IMG bitmap --add -f $IMGFMT "$TEST_IMG" b0 +$QEMU_IMG bitmap --add -f $IMGFMT "$TEST_IMG" b1 +$QEMU_IMG bitmap --add -f $IMGFMT "$TEST_IMG" b2 +_img_info --format-specific | _filter_irrelevant_img_info + +# Sweep every bitmap in a single command, no BITMAP positional +echo +$QEMU_IMG bitmap --remove-all -f $IMGFMT "$TEST_IMG" +_img_info --format-specific | _filter_irrelevant_img_info + +# Wipe + recreate in one invocation: only 'fresh' should remain +echo +$QEMU_IMG bitmap --add -f $IMGFMT "$TEST_IMG" b0 +$QEMU_IMG bitmap --add -f $IMGFMT "$TEST_IMG" b1 +$QEMU_IMG bitmap --remove-all --add -f $IMGFMT "$TEST_IMG" fresh +_img_info --format-specific | _filter_irrelevant_img_info + # success, all done echo '*** done' rm -f $seq.full
tests/qemu-iotests/tests/qemu-img-bitmaps.out +46 -0
50 lines not on this page · raw message
Signature · 1 line
2.54.0
Quoted 11 lines · Kevin Wolf
The following changes since commit
cc329c491768b2d91eb0b0984f3baa0bf805776d:Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2026-06-08 09:30:30 -0400)
are available in the Git repository at:
https://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to
296b66d05bac7eb2b86600febdbd2bd8d410f026:
Quoted 8 lines
qed: Don't try to flush during incoming migration (2026-06-08 17:00:47 +0200)
----------------------------------------------------------------
Block layer patches- qcow2: Fix data loss on zero write with detect-zeroes=unmap
- qemu-img bitmap: add sub-command --remove-all
- export/fuse: setFUSE_DIRECT_IO_ALLOW_MMAPflag to fix regression
Hi Fiona and Kevin,
Please take a look at the CI failure below. If the root cause is in this pull request, please send a new revision with fixed patches or without the patches that cause the failure. Thanks!
Quoted 1 line
Quoted 1 line
Quoted 1 line
UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 LD_LIBRARY_PATH=/builds/qemu-project/qemu/build/subprojects/libvfio-user/lib MALLOC_PERTURB_=83 MESON_TEST_ITERATION=1 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 PYTHON=/builds/qemu-project/qemu/build/pyvenv/bin/python3 RUST_BACKTRACE=1 /builds/qemu-project/qemu/build/pyvenv/bin/python3 /builds/qemu-project/qemu/build/../tests/qemu-iotests/check -tap -luks fuse-mmap-shared --source-dir /builds/qemu-project/qemu/tests/qemu-iotests --build-dir /builds/qemu-project/qemu/build/tests/qemu-iotests
――――――――――――――――――――――――――――――――――――― ✀ ――――――――――――――――――――――――――――――――――――― stderr:
builds/qemu-project/qemu/build/scratch/luks-file-fuse-mmap-shared/fuse-mmap-shared.out.bad renamed from builds/qemu-project/qemu/tests/qemu-iotests/tests/fuse-mmap-shared.out +6 -1
@@ -1,5 +1,22 @@ -. +E +====================================================================== +ERROR: test_mmap_shared (__main__.TestMmapShared) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/builds/qemu-project/qemu/tests/qemu-iotests/tests/fuse-mmap-shared",
line 55, in setUp
+ qemu_io(image, '-c', f'write -P 23 0 {image_size}')
+ File "/builds/qemu-project/qemu/tests/qemu-iotests/iotests.py", line 364, in qemu_io
+ return qemu_tool(*qemu_io_wrap_args(args),
+ File "/builds/qemu-project/qemu/tests/qemu-iotests/iotests.py", line 241, in qemu_tool
+ raise VerboseProcessError(
+qemu.utils.VerboseProcessError: Command '('/builds/qemu-project/qemu/build/qemu-io', '--cache', 'writeback', '--aio', 'threads', '/builds/qemu-project/qemu/build/scratch/luks-file-fuse-mmap-shared/image.luks', '-c', 'write -P 23 0 1048576')' returned non-zero exit status 1.
+ ┏━ output ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ┃ qemu-io: can't open device /builds/qemu-project/qemu/build/scratch/ + ┃ luks-file-fuse-mmap-shared/image.luks: Parameter 'key-secret' is + ┃ required for cipher + ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
----------------------------------------------------------------------
Ran 1 tests
-OK
+FAILED (errors=1)
https://gitlab.com/qemu-project/qemu/-/jobs/14772570524#L257
Stefan
Quoted 46 lines
- virtio-blk: add missing
VIRTIO_BLK_T_SCSI_CMDsize check (CVE-2026-48914)
- qed: Don't try to flush during incoming migration
- iotests/136: Test stats-intervals with -blockdev/-device----------------------------------------------------------------
Denis V. Lunev (1):qemu-img: add sub-command --remove-all to 'qemu-img bitmap'Fabiano Rosas (1):
qed: Don't try to flush during incoming migrationFiona Ebner (3):
block/export/fuse: use structfuse_init_inblock/export/fuse: setFUSE_DIRECT_IO_ALLOW_MMAPflag to fix regression
iotests: test shared mmap for fuse exportKevin Wolf (1):
iotests/136: Test stats-intervals with -blockdev/-deviceStefan Hajnoczi (1):
virtio-blk: add missing VIRTIO_BLK_T_SCSI_CMD size check (CVE-2026-48914)Thomas Lamprecht (1):
qcow2: Fix data loss on zero write with detect-zeroes=unmapdocs/tools/qemu-img.rst | 10 ++- block/qcow2.h | 4 + block/export/fuse.c | 69 +++++++++++++---- block/qcow2-cluster.c | 10 +-- block/qcow2.c | 8 +- block/qed.c | 16 ++-- hw/block/virtio-blk.c | 8 +- qemu-img.c | 55 ++++++++++++-- tests/qemu-iotests/046 | 23 ++++++ tests/qemu-iotests/046.out | 10 +++ tests/qemu-iotests/136 | 87 +++++++++++++++++++--- tests/qemu-iotests/136.out | 4 +- tests/qemu-iotests/tests/fuse-mmap-shared | 103 ++++++++++++++++++++++++++ tests/qemu-iotests/tests/fuse-mmap-shared.out | 5 ++ tests/qemu-iotests/tests/qemu-img-bitmaps | 24 ++++++ tests/qemu-iotests/tests/qemu-img-bitmaps.out | 46 ++++++++++++ 16 files changed, 430 insertions(+), 52 deletions(-) create mode 100755 tests/qemu-iotests/tests/fuse-mmap-shared create mode 100644 tests/qemu-iotests/tests/fuse-mmap-shared.out
Am 09.06.2026 um 19:44 hat Stefan Hajnoczi geschrieben:
Quoted 17 lines · Kevin Wolf
Quoted 16 lines
The following changes since commit
cc329c491768b2d91eb0b0984f3baa0bf805776d:Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2026-06-08 09:30:30 -0400)
are available in the Git repository at:
https://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to
296b66d05bac7eb2b86600febdbd2bd8d410f026:qed: Don't try to flush during incoming migration (2026-06-08 17:00:47 +0200)
----------------------------------------------------------------
Block layer patches
Quoted 8 lines
Quoted 3 lines
- qcow2: Fix data loss on zero write with detect-zeroes=unmap
- qemu-img bitmap: add sub-command --remove-all
- export/fuse: setFUSE_DIRECT_IO_ALLOW_MMAPflag to fix regressionHi Fiona and Kevin,
Please take a look at the CI failure below. If the root cause is in this pull request, please send a new revision with fixed patches or without the patches that cause the failure. Thanks!
Yes, it's a new test case introduced in this series that doesn't work with the luks driver. I just declared luks unsupported for the test for now and pushed a v2 (will send the new cover letter in a moment, too).
Kevin
Am 10.06.26 um 12:14 PM schrieb Kevin Wolf:
Quoted 22 lines
Am 09.06.2026 um 19:44 hat Stefan Hajnoczi geschrieben:
Quoted 21 lines · Kevin Wolf
Quoted 19 lines
The following changes since commit
cc329c491768b2d91eb0b0984f3baa0bf805776d:Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2026-06-08 09:30:30 -0400)
are available in the Git repository at:
https://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to
296b66d05bac7eb2b86600febdbd2bd8d410f026:qed: Don't try to flush during incoming migration (2026-06-08 17:00:47 +0200)
----------------------------------------------------------------
Block layer patches- qcow2: Fix data loss on zero write with detect-zeroes=unmap
- qemu-img bitmap: add sub-command --remove-all
- export/fuse: setFUSE_DIRECT_IO_ALLOW_MMAPflag to fix regression
Quoted 8 lines
Quoted 4 lines
Hi Fiona and Kevin,
Please take a look at the CI failure below. If the root cause is in this pull request, please send a new revision with fixed patches or without the patches that cause the failure. Thanks!Yes, it's a new test case introduced in this series that doesn't work with the luks driver. I just declared luks unsupported for the test for now and pushed a v2 (will send the new cover letter in a moment, too).
Sorry and thanks! I'll need to remember to check with luks in the future.
Best Regards,
Fiona
Quoted 28 lines · Fiona Ebner
Am 10.06.26 um 12:14 PM schrieb Kevin Wolf:
Quoted 27 lines
Am 09.06.2026 um 19:44 hat Stefan Hajnoczi geschrieben:
Quoted 25 lines · Kevin Wolf
Quoted 11 lines
The following changes since commit
cc329c491768b2d91eb0b0984f3baa0bf805776d:Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2026-06-08 09:30:30 -0400)
are available in the Git repository at:
https://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to
296b66d05bac7eb2b86600febdbd2bd8d410f026:Quoted 8 lines
qed: Don't try to flush during incoming migration (2026-06-08 17:00:47 +0200)
----------------------------------------------------------------
Block layer patches- qcow2: Fix data loss on zero write with detect-zeroes=unmap
- qemu-img bitmap: add sub-command --remove-all
- export/fuse: setFUSE_DIRECT_IO_ALLOW_MMAPflag to fix regressionHi Fiona and Kevin,
Please take a look at the CI failure below. If the root cause is in this pull request, please send a new revision with fixed patches or without the patches that cause the failure. Thanks!
Quoted 5 lines
Quoted 3 lines
Yes, it's a new test case introduced in this series that doesn't work with the luks driver. I just declared luks unsupported for the test for now and pushed a v2 (will send the new cover letter in a moment, too).
Sorry and thanks! I'll need to remember to check with luks in the future.
You just got unlucky with the new expanded CI testing introduced when my pull request was merged a few days ago. Previously gitlab CI only tested qcow2 and raw, and so compat with other drivers was "best effort" after the fact.
Now the gitlab CI runs I/O tests across 10 drivers, so it needs to work before merge, which is something contributors didn't need to think about before now.
If you push a branch to your gitlab fork and trigger CI, you'll see the results in the "block" job in the pipeline results.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Am 10.06.2026 um 13:17 hat Daniel P. Berrangé geschrieben:
Quoted 11 lines
You just got unlucky with the new expanded CI testing introduced when my pull request was merged a few days ago. Previously gitlab CI only tested qcow2 and raw, and so compat with other drivers was "best effort" after the fact.
Now the gitlab CI runs I/O tests across 10 drivers, so it needs to work before merge, which is something contributors didn't need to think about before now.
If you push a branch to your gitlab fork and trigger CI, you'll see the results in the "block" job in the pipeline results.
Technically true, but who has the CI minutes to actually do this? I don't think we've figured out a solution yet how people (or at least maintainers) can use QEMU's minutes from the open source program prior to sending a patch series or pull request. Or have we?
Kevin
Quoted 6 lines · Kevin Wolf
Am 10.06.2026 um 13:17 hat Daniel P. Berrangé geschrieben:
Quoted 5 lines
You just got unlucky with the new expanded CI testing introduced when my pull request was merged a few days ago. Previously gitlab CI only tested qcow2 and raw, and so compat with other drivers was "best effort" after the fact.
Quoted 8 lines
Quoted 6 lines
Now the gitlab CI runs I/O tests across 10 drivers, so it needs to work before merge, which is something contributors didn't need to think about before now.
If you push a branch to your gitlab fork and trigger CI, you'll see the results in the "block" job in the pipeline results.
Technically true, but who has the CI minutes to actually do this?
Pretty much everyone IMHO.
Quoted 3 lines
I don't think we've figured out a solution yet how people (or at least maintainers) can use QEMU's minutes from the open source program prior to sending a patch series or pull request. Or have we?
GitLab user accounts get 400 minutes of CI credits.
Forks of QEMU though are only charged at a cost fact or 0.008 since we are a member of the OSS program
https://docs.gitlab.com/ci/pipelines/compute_minutes/#cost-factors-of-hosted-runners-for-gitlabcom
IOW, you're charged 1 minute per 125 minutes of job time.
A single QEMU pipline run in my fork today cost 4.5 credits. That's enough for 87 pipeline runs per month, if I was not contributing to anything outside QEMU on gitlab.com.
If you run a pipeline to sanity check before sending a patch series I don't think most people will ever run out of credits.
If you run multiple pipelines a day during development then you might be pushing your luck. Better to use the local "make docker-...." targets for day-to-day testing during dev, and just use gitlab pipelines before submission.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Am 10.06.2026 um 13:48 hat Daniel P. Berrangé geschrieben:
Quoted 35 lines · Kevin Wolf
Quoted 6 lines
Am 10.06.2026 um 13:17 hat Daniel P. Berrangé geschrieben:
Quoted 5 lines
You just got unlucky with the new expanded CI testing introduced when my pull request was merged a few days ago. Previously gitlab CI only tested qcow2 and raw, and so compat with other drivers was "best effort" after the fact.
Quoted 8 lines
Quoted 6 lines
Now the gitlab CI runs I/O tests across 10 drivers, so it needs to work before merge, which is something contributors didn't need to think about before now.
If you push a branch to your gitlab fork and trigger CI, you'll see the results in the "block" job in the pipeline results.
Technically true, but who has the CI minutes to actually do this?
Pretty much everyone IMHO.
Quoted 3 lines
I don't think we've figured out a solution yet how people (or at least maintainers) can use QEMU's minutes from the open source program prior to sending a patch series or pull request. Or have we?
GitLab user accounts get 400 minutes of CI credits.
Forks of QEMU though are only charged at a cost fact or 0.008 since we are a member of the OSS program
https://docs.gitlab.com/ci/pipelines/compute_minutes/#cost-factors-of-hosted-runners-for-gitlabcom
IOW, you're charged 1 minute per 125 minutes of job time.
A single QEMU pipline run in my fork today cost 4.5 credits. That's enough for 87 pipeline runs per month, if I was not contributing to anything outside QEMU on gitlab.com.
Quoted 7 lines
If you run a pipeline to sanity check before sending a patch series I don't think most people will ever run out of credits.
If you run multiple pipelines a day during development then you might be pushing your luck. Better to use the local "make docker-...." targets for day-to-day testing during dev, and just use gitlab pipelines before submission.
Did this change at some point? Because I'm quite sure I stopped doing full CI runs only after running out of minutes with very moderate use. Ever since then, I've only manually started individual jobs when I had reason to suspect there could be a problem with them.
Kevin
Quoted 44 lines · Kevin Wolf
Am 10.06.2026 um 13:48 hat Daniel P. Berrangé geschrieben:
Quoted 35 lines · Kevin Wolf
Quoted 6 lines
Am 10.06.2026 um 13:17 hat Daniel P. Berrangé geschrieben:
Quoted 5 lines
You just got unlucky with the new expanded CI testing introduced when my pull request was merged a few days ago. Previously gitlab CI only tested qcow2 and raw, and so compat with other drivers was "best effort" after the fact.
Quoted 8 lines
Quoted 6 lines
Now the gitlab CI runs I/O tests across 10 drivers, so it needs to work before merge, which is something contributors didn't need to think about before now.
If you push a branch to your gitlab fork and trigger CI, you'll see the results in the "block" job in the pipeline results.
Technically true, but who has the CI minutes to actually do this?
Pretty much everyone IMHO.
Quoted 3 lines
I don't think we've figured out a solution yet how people (or at least maintainers) can use QEMU's minutes from the open source program prior to sending a patch series or pull request. Or have we?
GitLab user accounts get 400 minutes of CI credits.
Forks of QEMU though are only charged at a cost fact or 0.008 since we are a member of the OSS program
https://docs.gitlab.com/ci/pipelines/compute_minutes/#cost-factors-of-hosted-runners-for-gitlabcom
IOW, you're charged 1 minute per 125 minutes of job time.
A single QEMU pipline run in my fork today cost 4.5 credits. That's enough for 87 pipeline runs per month, if I was not contributing to anything outside QEMU on gitlab.com.
Quoted 7 lines
If you run a pipeline to sanity check before sending a patch series I don't think most people will ever run out of credits.
If you run multiple pipelines a day during development then you might be pushing your luck. Better to use the local "make docker-...." targets for day-to-day testing during dev, and just use gitlab pipelines before submission.
Quoted 4 lines
Did this change at some point? Because I'm quite sure I stopped doing full CI runs only after running out of minutes with very moderate use. Ever since then, I've only manually started individual jobs when I had reason to suspect there could be a problem with them.
Yes, there was a time window when QEMU was *not* part of the OSS program and so forks would get charged at the full 1:1 rate. At the same time gitlab was transitioning personal accounts from two different CI limits, so those with newer accounts would run out much faster due to a lower limit than other people with older accounts like myself. Everyone now has the same 400 minute limit, with the 0.008 cost factor inherited.
The only caveat is that your git repo *MUST* be a direct fork of qemu-project/qemu.git in order to inherit the cost factor.
So, yes, there were problems in the past, but it should be much better for most people today.
And we do have the "QEMU_CI=1" push option to trigger individual jobs manually vs "QEMU_CI=2" run unleashes the whole pipeline, so users can conserve CI credits if debugging a specific job over & over again.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|