block: vhdx: Fix VHDX multiqueue data corruption - #7746
Merged
Merged
Conversation
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]>
likebreath
approved these changes
Feb 23, 2026
Merged
via the queue into
cloud-hypervisor:main
with commit Feb 23, 2026
6f19d00
38 of 42 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The VHDX backend suffered from data corruption when used with multiple virtio-blk queues.
Vhdx::clone()usesdup(), which creates a new file descriptor sharing the same kernel file description, including the file offset. With multiple queues performing concurrentseek()+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 theVhdxinstance inArc<Mutex<>>so all queues serialize through a single mutex-protected backend.The existing
test_virtio_block_fstrim_unsupported_vhdxintegration test is re-enabled.Fixes #7665