Skip to contentSkip to conversation

Patch "dm btree: fix for dm_btree_find_lowest_key()" has been added to the 4.11-stable tree

PATCH [email protected] 1 participant 1 message May 22, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

dm btree: fix for dm_btree_find_lowest_key()

to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dm-btree-fix-for-dm_btree_find_lowest_key.patch
and it can be found in the queue-4.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 7d1fedb6e96a960aa91e4ff70714c3fb09195a5a Mon Sep 17 00:00:00 2001

From: Vinothkumar Raja <[email protected]>
Date: Thu, 6 Apr 2017 22:09:38 -0400
Subject: dm btree: fix for dm_btree_find_lowest_key()

From: Vinothkumar Raja <[email protected]>

commit 7d1fedb6e96a960aa91e4ff70714c3fb09195a5a upstream.

dm_btree_find_lowest_key() is giving incorrect results. find_key() traverses the btree correctly for finding the highest key, but there is an error in the way it traverses the btree for retrieving the lowest key. dm_btree_find_lowest_key() fetches the first key of the rightmost block of the btree instead of fetching the first key from the leftmost block.

Fix this by conditionally passing the correct parameter to value64() based on the @find_highest flag.

---
 drivers/md/persistent-data/dm-btree.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/persistent-data/dm-btree.c +6 -2
@@ -902,8 +902,12 @@ static int find_key(struct ro_spine *s,
 		else
 			*result_key = le64_to_cpu(ro_node(s)->keys[0]);
 
-		if (next_block || flags & INTERNAL_NODE)
-			block = value64(ro_node(s), i);
+		if (next_block || flags & INTERNAL_NODE) {
+			if (find_highest)
+				block = value64(ro_node(s), i);
+			else
+				block = value64(ro_node(s), 0);
+		}
 
 	} while (flags & INTERNAL_NODE);
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.11/dm-btree-fix-for-dm_btree_find_lowest_key.patch