[haiku-commits] haiku: hrev43913 - src/add-ons/kernel/file_systems/bfs

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 31 Mar 2012 14:26:20 +0200 (CEST)

hrev43913 adds 3 changesets to branch 'master'
old head: 577265d14f71407c7ce93639bbe7938678afe4c2
new head: 97b80db250bc368bad86cc8a6c2f8dee5f781238

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

09ec0ad: Also report errors when the free list is broken.
  
  * This will cause the whole B+tree to be rewritten in that case, too.
  * Added a TODO comment that describes an alternative solution for this.

439495d: Inode was leaking its small data lock.
  
  * This should not have harmed normal operation (as an Inode is only destroyed
    when it is no longer being used), but the fs_shell could run out of
    semaphores easily.

97b80db: Fixed a possible KDL; the inode might be NULL.
  
  * This happens in case the inode could not be opened in the first place.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

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

3 files changed, 9 insertions(+), 3 deletions(-)
src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp  |    3 +++
.../kernel/file_systems/bfs/BlockAllocator.cpp     |    6 ++++--
src/add-ons/kernel/file_systems/bfs/Inode.cpp      |    3 ++-

############################################################################

Commit:      09ec0ad9c3a6df800816b8df6617dc9e30ba24ca
URL:         http://cgit.haiku-os.org/haiku/commit/?id=09ec0ad
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Sat Mar 31 09:10:51 2012 UTC

Also report errors when the free list is broken.

* This will cause the whole B+tree to be rewritten in that case, too.
* Added a TODO comment that describes an alternative solution for this.

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

diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 
b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
index ded3b14..2720f72 100644
--- a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
@@ -709,6 +709,9 @@ BPlusTree::Validate(bool repair, bool& _errorsFound)
                if (check.Visited(freeOffset)) {
                        dprintf("inode %" B_PRIdOFF ": free node at %" B_PRIdOFF
                                " circular!\n", fStream->ID(), freeOffset);
+                       // TODO: if 'repair' is true, we could collect all 
unvisited nodes
+                       // at the end, and put the into the free list
+                       check.FoundError();
                        break;
                }
 

############################################################################

Commit:      439495d8d418b0f1106d3a933b05eb4702502af8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=439495d
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Sat Mar 31 12:23:00 2012 UTC

Inode was leaking its small data lock.

* This should not have harmed normal operation (as an Inode is only destroyed
  when it is no longer being used), but the fs_shell could run out of
  semaphores easily.

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

diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp 
b/src/add-ons/kernel/file_systems/bfs/Inode.cpp
index 670c955..dd03c22 100644
--- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2001-2012, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
  * This file may be used under the terms of the MIT License.
  */
 
@@ -400,6 +400,7 @@ Inode::~Inode()
        delete fTree;
 
        rw_lock_destroy(&fLock);
+       recursive_lock_destroy(&fSmallDataLock);
 }
 
 

############################################################################

Revision:    hrev43913
Commit:      97b80db250bc368bad86cc8a6c2f8dee5f781238
URL:         http://cgit.haiku-os.org/haiku/commit/?id=97b80db
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Sat Mar 31 12:24:22 2012 UTC

Fixed a possible KDL; the inode might be NULL.

* This happens in case the inode could not be opened in the first place.

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

diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 
b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
index 51877b7..8481897 100644
--- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
@@ -2052,8 +2052,10 @@ BlockAllocator::_FreeIndices()
 {
        for (int32 i = 0; i < fCheckCookie->indices.CountItems(); i++) {
                check_index* index = fCheckCookie->indices.Array()[i];
-               put_vnode(fVolume->FSVolume(),
-                       fVolume->ToVnode(index->inode->BlockRun()));
+               if (index->inode != NULL) {
+                       put_vnode(fVolume->FSVolume(),
+                               fVolume->ToVnode(index->inode->BlockRun()));
+               }
        }
        fCheckCookie->indices.MakeEmpty();
 }


Other related posts:

  • » [haiku-commits] haiku: hrev43913 - src/add-ons/kernel/file_systems/bfs - axeld