[vm] Minor fix in debug asserts in shm

This commit is contained in:
Shaowei Song 2023-06-26 19:28:39 +08:00 committed by volcano
parent 52d6a92929
commit e2f7e6109a
2 changed files with 3 additions and 2 deletions

@ -187,9 +187,10 @@ impl ShmManager {
}
pub fn replace_shared_chunk(&mut self, old_shared_chunk: ChunkRef, new_chunk: ChunkRef) {
debug_assert!(old_shared_chunk.is_shared() && new_chunk.is_shared());
debug_assert!(old_shared_chunk.is_shared());
let inode_id = {
let mut new_vma = Self::vma_of(&new_chunk);
new_vma.mark_shared();
let old_vma = Self::vma_of(&old_shared_chunk);
// Inherits access and perms from the old one
new_vma.inherits_access_from(&old_vma);

@ -714,10 +714,10 @@ impl InternalVMManager {
MmapSharedResult::NeedExpand(old_shared_chunk, expand_range) => {
let new_chunk = {
let new_chunk = self.new_chunk_with_options(options)?;
debug_assert_eq!(*new_chunk.range(), expand_range);
self.merge_two_single_vma_chunks(&old_shared_chunk, &new_chunk)
};
let new_range = *new_chunk.range();
debug_assert_eq!(new_range, expand_range);
self.shm_manager
.replace_shared_chunk(old_shared_chunk, new_chunk);
Ok(new_range.start())