Fix crash while reading metadata

blocking-uring-test
Vitaliy Filippov 2019-11-26 12:06:42 +03:00
parent a8f250c68f
commit a6770f619a
1 changed files with 2 additions and 3 deletions

View File

@ -80,15 +80,14 @@ int blockstore_init_meta::loop()
void blockstore_init_meta::handle_entries(struct clean_disk_entry* entries, int count, int block_order)
{
auto end = bs->clean_db.end();
for (unsigned i = 0; i < count; i++)
{
if (entries[i].oid.inode > 0)
{
auto clean_it = bs->clean_db.find(entries[i].oid);
if (clean_it == end || clean_it->second.version < entries[i].version)
if (clean_it == bs->clean_db.end() || clean_it->second.version < entries[i].version)
{
if (clean_it != end)
if (clean_it != bs->clean_db.end())
{
// free the previous block
allocator_set(bs->data_alloc, clean_it->second.version >> block_order, false);