mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 19:32:20 +00:00
vm-virtio: Don't waste a descriptor if not filled
In case the virtio descriptor is pulled out of the Queue iterator, it is important to fill it and tag it as used. This is already done from the successful code path, but in case there's an error during the filling, we should make sure to put the descriptor back in the list of available descriptors. This way, when the error occurs, we don't loose a descriptor, and it could be used later. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
7a3e6caca4
commit
e4c3401a33
@ -93,6 +93,7 @@ impl ConsoleEpollHandler {
|
||||
let source_slice = in_buffer.drain(..len as usize).collect::<Vec<u8>>();
|
||||
if let Err(e) = mem.write_slice(&source_slice[..], avail_desc.addr) {
|
||||
error!("Failed to write slice: {:?}", e);
|
||||
recv_queue.go_to_previous_position();
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user