Thanks to visit codestin.com
Credit goes to github.com

Skip to content

block: vhdx: Fix VHDX multiqueue data corruption - #7746

Merged
likebreath merged 2 commits into
cloud-hypervisor:mainfrom
weltling:vhdx-multiqueue
Feb 23, 2026
Merged

likebreath merged 2 commits into
cloud-hypervisor:mainfrom
weltling:vhdx-multiqueue

Conversation

@weltling

Copy link
Copy Markdown
Member

The VHDX backend suffered from data corruption when used with multiple virtio-blk queues. Vhdx::clone() uses dup(), which creates a new file descriptor sharing the same kernel file description, including the file offset. With multiple queues performing concurrent seek() + read()/write() on the shared offset, I/O operations race and corrupt data.

This is the same class of bug that was fixed for QCOW2 in 9bc367a ("block: qcow: Use Arc<Mutex<QcowFile>> for safe multi-queue access"). The fix is identical: wrap the Vhdx instance in Arc<Mutex<>> so all queues serialize through a single mutex-protected backend.

The existing test_virtio_block_fstrim_unsupported_vhdx integration test is re-enabled.

Fixes #7665

Remove the #[ignore] attribute from
test_virtio_block_fstrim_unsupported_vhdx.

Signed-off-by: Anatol Belski <[email protected]>
Wrap the Vhdx instance in Arc<Mutex<>> so that all queues share
a single mutex-protected backend, matching the approach already
used for QCOW2.

Vhdx::clone() uses dup() which shares the kernel file description
including the file offset. With multiple queues performing
concurrent seek+read/write on the shared offset, I/O operations
race and corrupt data.

Fixes: cloud-hypervisor#7665

Signed-off-by: Anatol Belski <[email protected]>
@weltling
weltling requested a review from a team as a code owner February 23, 2026 17:22
@likebreath
likebreath added this pull request to the merge queue Feb 23, 2026
Merged via the queue into cloud-hypervisor:main with commit 6f19d00 Feb 23, 2026
38 of 42 checks passed
@weltling
weltling deleted the vhdx-multiqueue branch February 23, 2026 20:34
@rbradford rbradford moved this to ✅ Done in Cloud Hypervisor Roadmap Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

block: VHDX: Multiqueue support causes filesystem corruption

3 participants