An unused dirty block would put again into the unused list.

* This could cause bug #8123. While this fixes the crash, one underlying
  problem is still there, as dirty blocks should never leave a transaction.
This commit is contained in:
Andreas Henriksson 2012-07-19 23:37:42 +02:00 committed by Axel Dörfler
parent 03aa456e2e
commit 8959a4e0c3
2 changed files with 4 additions and 2 deletions

View File

@ -1268,7 +1268,7 @@ BlockWriter::_BlockDone(cached_block* block, hash_iterator* iterator)
fDeletedTransaction = true;
}
}
if (block->transaction == NULL && block->ref_count == 0) {
if (block->transaction == NULL && block->ref_count == 0 && !block->unused) {
// the block is no longer used
block->unused = true;
fCache->unused_blocks.Add(block);
@ -1761,7 +1761,9 @@ put_cached_block(block_cache* cache, cached_block* block)
cache->RemoveBlock(block);
} else {
// put this block in the list of unused blocks
ASSERT(!block->unused);
block->unused = true;
ASSERT(block->original_data == NULL
&& block->parent_data == NULL);
cache->unused_blocks.Add(block);

View File

@ -927,7 +927,7 @@ write_cached_block(block_cache* cache, cached_block* block,
}
}
}
if (block->transaction == NULL && block->ref_count == 0) {
if (block->transaction == NULL && block->ref_count == 0 && !block->unused) {
// the block is no longer used
block->unused = true;
cache->unused_blocks.Add(block);