Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ and this project adheres to
Terminating a connection now also discards its TX buffer, so the device stops
advertising `EPOLLOUT` for a host stream it will never write to again, which
could otherwise busy-spin the event thread indefinitely.
- [#6083](https://github.com/firecracker-microvm/firecracker/pull/6083): Fixed a
vhost-user-block device backed by a readonly backend not being treated as
readonly. The `VIRTIO_BLK_F_RO` check read the acked feature set after it had
been narrowed to the vhost-user protocol bit, so it never matched, and a
readonly vhost-user root device was given `rw` on the guest kernel cmdline.
- [#6086](https://github.com/firecracker-microvm/firecracker/pull/6086),
[#6143](https://github.com/firecracker-microvm/firecracker/pull/6143): Fixed a
deadlock in the logger: a signal handler that logs while the interrupted
Expand Down
6 changes: 4 additions & 2 deletions src/vmm/src/devices/virtio/block/vhost_user/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,13 @@ impl<T: VhostUserHandleBackend> VhostUserBlockImpl<T> {
u64_to_usize(NUM_QUEUES)];
let device_state = DeviceState::Inactive;

// Read before `acked_features` is narrowed to the protocol bit below.
let read_only = acked_features & (1 << VIRTIO_BLK_F_RO) != 0;

// We negotiated features with backend. Now these acked_features
// are available for guest driver to choose from.
let avail_features = acked_features;
let acked_features = acked_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
let read_only = acked_features & (1 << VIRTIO_BLK_F_RO) != 0;
let vhost_user_block_metrics_name = format!("block_{}", config.drive_id);

let metrics = VhostUserMetricsPerDevice::alloc(vhost_user_block_metrics_name);
Expand Down Expand Up @@ -657,7 +659,7 @@ mod tests {
VhostUserHeaderFlag::empty().bits()
);
assert!(!vhost_block.root_device);
assert!(!vhost_block.read_only);
assert!(vhost_block.read_only);
assert_eq!(vhost_block.config_space, vec![0x69, 0x69, 0x69]);

// Test some `VirtioDevice` methods
Expand Down
Loading