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

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 20 Oct 2014 22:52:58 +0200 (CEST)

hrev48059 adds 1 changeset to branch 'master'
old head: de59ef0760a22d2ec172f9283427a7d44d1d6f27
new head: 33d9fb8663e384b7ad8edb015eac2b2ee88c2d3b
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=33d9fb8+%5Ede59ef0

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

33d9fb8: BFS: Fix check of key compare in BPlusTree::_ValidateChildren().
  
  In ba320218245aeb11cb74c37ecf7132d0b9903957 the key comparison was fixed
  to use a compatible version. Since then the check can actually return
  results other than -1. The check done on the result was too strict
  however. The child nodes may never contain keys that are larger than the
  keys they are reached by. But the last key of a child node may be equal
  to the one in the parent. This change fixes the check to take this
  special case into account.
  
  Fixes #11026 and #11289. The issue was unproblematic in so far that it
  was only hit during a filesystem check and, since BPlusTree does not
  yet attempt to correct corrupted trees, did not result in any actual
  actions.

                                            [ Michael Lotz <mmlr@xxxxxxxx> ]

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

Revision:    hrev48059
Commit:      33d9fb8663e384b7ad8edb015eac2b2ee88c2d3b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=33d9fb8
Author:      Michael Lotz <mmlr@xxxxxxxx>
Date:        Sun Oct 19 22:13:03 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/11026
Ticket:      https://dev.haiku-os.org/ticket/11289

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

1 file changed, 1 insertion(+), 1 deletion(-)
src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp | 2 +-

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

diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 
b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
index bb281d4..1688591 100644
--- a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
@@ -2367,7 +2367,7 @@ BPlusTree::_ValidateChildren(TreeCheck& check, uint32 
level, off_t offset,
                if (largestKey != NULL) {
                        int result = _CompareKeys(key, keyLength, largestKey,
                                largestKeyLength);
-                       if (result >= 0) {
+                       if (result > 0 || (result == 0 && i != count - 1)) {
                                dprintf("inode %" B_PRIdOFF ": node %" 
B_PRIdOFF " key %"
                                        B_PRIu32 " larger than it should!\n",
                                        fStream->ID(), offset, i);


Other related posts:

  • » [haiku-commits] haiku: hrev48059 - src/add-ons/kernel/file_systems/bfs - mmlr