From 9569809d4cc8e640302c3e5fe6f8b21634c356f2 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 11 Dec 2025 10:52:00 +0100 Subject: [PATCH] block: fix bug with wrong lock granularity for image container formats The lock must always correspond to the physical size of the file, everything else doesn't make sense. Signed-off-by: Philipp Schuster On-behalf-of: SAP philipp.schuster@sap.com --- virtio-devices/src/block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtio-devices/src/block.rs b/virtio-devices/src/block.rs index c7fc934c4..0f46ce389 100644 --- a/virtio-devices/src/block.rs +++ b/virtio-devices/src/block.rs @@ -773,7 +773,7 @@ impl Block { // TODO In future, we could add a `lock_granularity=` configuration to the CLI. // For now, we stick to QEMU behavior. fn lock_granularity(&mut self) -> LockGranularity { - self.disk_image.logical_size().map_or_else( + self.disk_image.physical_size().map_or_else( // use a safe fallback |e| { let fallback = LockGranularity::WholeFile;