Compare commits

...

1 Commits

Author SHA1 Message Date
Vitaliy Filippov cbde49e73d Double-check for double-alloc bugs 2021-12-14 02:09:36 +03:00
1 changed files with 10 additions and 0 deletions

View File

@ -268,6 +268,16 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
cancel_all_writes(op, dirty_it, -ENOSPC); cancel_all_writes(op, dirty_it, -ENOSPC);
return 2; return 2;
} }
#ifndef NDEBUG
// Double-check to not overwrite anything if easily possible
if (inmemory_meta)
{
uint64_t sector = (loc / (meta_block_size / clean_entry_size)) * meta_block_size;
uint64_t pos = (loc % (meta_block_size / clean_entry_size));
clean_disk_entry *meta_entry = (clean_disk_entry*)(metadata_buffer + sector + pos*clean_entry_size);
assert(!meta_entry->oid.inode);
}
#endif
write_iodepth++; write_iodepth++;
BS_SUBMIT_GET_SQE(sqe, data); BS_SUBMIT_GET_SQE(sqe, data);
dirty_it->second.location = loc << block_order; dirty_it->second.location = loc << block_order;