aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Henriksson <sausageboy@gmail.com>2012-07-19 23:37:42 +0200
committerAxel Dörfler <axeld@pinc-software.de>2012-07-19 23:44:25 +0200
commit8959a4e0c37873f56f44ea1743902de0ec0e44d4 (patch)
tree3bd05b4a60af5393b0d32fc49659d8c997a42ca3
parent03aa456e2effa939895246dce37cd2454f5534d7 (diff)
An unused dirty block would put again into the unused list.hrev44355
* This could cause bug #8123. While this fixes the crash, one underlying problem is still there, as dirty blocks should never leave a transaction.
-rw-r--r--src/system/kernel/cache/block_cache.cpp4
-rw-r--r--src/tools/fs_shell/block_cache.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp
index b49bf6e902..e0c258b804 100644
--- a/src/system/kernel/cache/block_cache.cpp
+++ b/src/system/kernel/cache/block_cache.cpp
@@ -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);
diff --git a/src/tools/fs_shell/block_cache.cpp b/src/tools/fs_shell/block_cache.cpp
index 78f69d2865..2f47a094dc 100644
--- a/src/tools/fs_shell/block_cache.cpp
+++ b/src/tools/fs_shell/block_cache.cpp
@@ -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);