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 <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-12-11 10:52:00 +01:00
committed by Rob Bradford
parent 603b5e862c
commit 9569809d4c

View File

@@ -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;