[haiku-commits] haiku: hrev44355 - in src: system/kernel/cache tools/fs_shell

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 19 Jul 2012 23:45:14 +0200 (CEST)

hrev44355 adds 1 changeset to branch 'master'
old head: 03aa456e2effa939895246dce37cd2454f5534d7
new head: 8959a4e0c37873f56f44ea1743902de0ec0e44d4

----------------------------------------------------------------------------

8959a4e: 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.

                               [ Andreas Henriksson <sausageboy@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44355
Commit:      8959a4e0c37873f56f44ea1743902de0ec0e44d4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8959a4e
Author:      Andreas Henriksson <sausageboy@xxxxxxxxx>
Date:        Thu Jul 19 21:37:42 2012 UTC
Committer:   Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Commit-Date: Thu Jul 19 21:44:25 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/8123

----------------------------------------------------------------------------

2 files changed, 4 insertions(+), 2 deletions(-)
src/system/kernel/cache/block_cache.cpp |    4 +++-
src/tools/fs_shell/block_cache.cpp      |    2 +-

----------------------------------------------------------------------------

diff --git a/src/system/kernel/cache/block_cache.cpp 
b/src/system/kernel/cache/block_cache.cpp
index b49bf6e..e0c258b 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 78f69d2..2f47a09 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);


Other related posts: