mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-23 00:11:16 +00:00
virtio-devices: Reset offset properly upon unmap for virtio-fs.
We should reset the offset to 0, when asked to remove the whole dax mapping. Signed-off-by: Hao Xu <howeyxu@tencent.com>
This commit is contained in:
parent
85962099c7
commit
74cd3d0dc2
@ -119,7 +119,6 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
debug!("fs_slave_unmap");
|
debug!("fs_slave_unmap");
|
||||||
|
|
||||||
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
||||||
let offset = fs.cache_offset[i];
|
|
||||||
let mut len = fs.len[i];
|
let mut len = fs.len[i];
|
||||||
|
|
||||||
// Ignore if the length is 0.
|
// Ignore if the length is 0.
|
||||||
@ -129,9 +128,12 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
|
|
||||||
// Need to handle a special case where the slave ask for the unmapping
|
// Need to handle a special case where the slave ask for the unmapping
|
||||||
// of the entire mapping.
|
// of the entire mapping.
|
||||||
if len == 0xffff_ffff_ffff_ffff {
|
let offset = if len == 0xffff_ffff_ffff_ffff {
|
||||||
len = self.cache_size;
|
len = self.cache_size;
|
||||||
}
|
0
|
||||||
|
} else {
|
||||||
|
fs.cache_offset[i]
|
||||||
|
};
|
||||||
|
|
||||||
if !self.is_req_valid(offset, len) {
|
if !self.is_req_valid(offset, len) {
|
||||||
return Err(io::Error::from_raw_os_error(libc::EINVAL));
|
return Err(io::Error::from_raw_os_error(libc::EINVAL));
|
||||||
|
Loading…
Reference in New Issue
Block a user