blockdev: add workaround for issue #3229

Enforce the 'writeback' cache setting for an EFI disk with RBD driver
to work around issue #3229. See also commit 6aaad230 ("fix #3329: turn
on cache=writeback for efidisks on rbd").

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2025-06-23 17:44:19 +02:00 committed by Fabian Grünbichler
parent 8ca64671a7
commit f2f2edcd7f

View file

@ -128,7 +128,14 @@ sub generate_file_blockdev {
$scfg = PVE::Storage::storage_config($storecfg, $storeid);
}
$blockdev->{cache} = generate_blockdev_drive_cache($drive, $scfg);
# SPI flash does lots of read-modify-write OPs, without writeback this gets really slow #3329
# It also needs the rbd_cache_policy set to 'writeback' on the RBD side, which is done by the
# storage layer.
if ($blockdev->{driver} eq 'rbd' && $drive->{interface} eq 'efidisk') {
$blockdev->{cache} = { direct => JSON::false, 'no-flush' => JSON::false };
} else {
$blockdev->{cache} = generate_blockdev_drive_cache($drive, $scfg);
}
my $driver = $blockdev->{driver};
# only certain drivers have the aio setting