diff options
| author | Axel Dörfler <axeld@pinc-software.de> | 2012-07-19 23:57:10 +0200 |
|---|---|---|
| committer | Axel Dörfler <axeld@pinc-software.de> | 2012-07-20 00:03:38 +0200 |
| commit | 752f5c972f1a874cc7f93787e1a3bce6396c891e (patch) | |
| tree | 8e549cb20d37a5f3ec94db8ec76efc31e2242390 | |
| parent | 0579a695648c072e5c6decb6d35bf2ac5168a37f (diff) | |
cache_abort_[sub_]transaction() did not work correctly.hrev44357
* cache_abort_transaction() left the block dirty which was causing bug
#8123 as well.
* cache_abort_sub_transaction() did, in addition to not clearing the dirty
flag, not reset the block's transaction member either if the block was
not part of the parent transaction.
| -rw-r--r-- | src/system/kernel/cache/block_cache.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index cc5b663531..943e6517f0 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -2877,6 +2877,8 @@ cache_abort_transaction(void* _cache, int32 id) block->transaction_next = NULL; block->transaction = NULL; block->discard = false; + if (block->previous_transaction == NULL) + block->is_dirty = false; } hash_remove(cache->transaction_hash, transaction); @@ -3028,17 +3030,24 @@ cache_abort_sub_transaction(void* _cache, int32 id) next = block->transaction_next; if (block->parent_data == NULL) { - // the parent transaction didn't change the block, but the sub - // transaction did - we need to revert from the original data + // The parent transaction didn't change the block, but the sub + // transaction did - we need to revert to the original data. + // The block is no longer part of the transaction ASSERT(block->original_data != NULL); memcpy(block->current_data, block->original_data, cache->block_size); + block->transaction_next = NULL; + block->transaction = NULL; + if (block->previous_transaction == NULL) + block->is_dirty = false; } else if (block->parent_data != block->current_data) { - // the block has been changed and must be restored + // The block has been changed and must be restored - the block + // is still dirty and part of the transaction TRACE(("cache_abort_sub_transaction(id = %ld): restored contents " "of block %Ld\n", transaction->id, block->block_number)); memcpy(block->current_data, block->parent_data, cache->block_size); cache->Free(block->parent_data); + // The block stays dirty } block->parent_data = NULL; |
